├── .gitignore ├── README.md ├── p2p.iml ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── sr │ │ └── p2p │ │ ├── aspect │ │ └── SystemControllerLogger.java │ │ ├── controller │ │ ├── MemberController.java │ │ ├── rest │ │ │ └── SessionController.java │ │ └── util │ │ │ └── Response.java │ │ ├── dao │ │ └── RoleResourcesMapper.java │ │ ├── model │ │ ├── Resource.java │ │ ├── Role.java │ │ ├── RoleResource.java │ │ ├── User.java │ │ └── UserRole.java │ │ ├── security │ │ ├── P2PAccessDecisionManager.java │ │ ├── P2PBeforeSecurityInterceptor.java │ │ ├── P2PFilterInvocationSecurityMetadataSource.java │ │ ├── P2PUserDetailsService.java │ │ └── P2PUsernamePasswordAuthenticationFilter.java │ │ └── service │ │ ├── RoleResourcesService.java │ │ └── impl │ │ └── RoleResourcesServiceImpl.java ├── resources │ ├── applicationContext-dataSource.xml │ ├── applicationContext-logger.xml │ ├── applicationContext-security.xml │ ├── dispatcher-servlet.xml │ ├── log4j.properties │ ├── mapper │ │ └── RoleResourcesMapper.xml │ └── sqlMapConfig.xml └── webapp │ ├── WEB-INF │ └── web.xml │ ├── index.html │ ├── login.html │ └── static │ ├── css │ ├── bootstrap.min.css │ ├── img │ │ └── carousel.jpg │ └── moudle │ │ ├── carousel │ │ └── carousel.css │ │ └── grid │ │ └── grid.css │ ├── script │ ├── bootstrap.min.js │ ├── bootstrap │ │ └── dist │ │ │ └── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ ├── jquery-1.11.3.min.js │ ├── require-setup.js │ ├── require.js │ ├── view │ │ └── index.js │ └── widget │ │ └── navbar.js │ └── view │ └── member │ └── index.html └── test └── java └── database ├── records.sql ├── seq.sql ├── tables.sql └── triger.sql /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # p2p 2 | 3 | p2p 互联网金融项目 Demo 4 | 5 | 使用技术: bootstrap , jquery ,spring mvc , spring security , mybatis , bonecp ,oracle 6 | 7 | ## 1.技术层面前后台分离 8 | 9 | 前台使用纯 html5 + css3 + bootstrap + javascript + js框架 10 | 后台业务层使用 spring mvc 注解方式 11 | 后台安全框架 spring security ioc 方式(简单) 12 | 后台数据库 mybatis + oracle ,连接池采用 bonecp 13 | 日志框架 log4j 14 | 15 | ## 2.前后台使用 http 协议通讯 数据格式为 json 16 | 17 | ## 3. Spring Security 18 | 数据库文件 : records.sql(默认记录), seq.sql(序列), tables.sql(表),triger.sql(触发器) 19 | 数据表 :RESOURCES(资源表),ROLES(角色表),ROLES_RESOURCES(角色资源表),USERS(用户表),USERS_ROLES(用户角色表 ) 20 | 业务关系:系统启动时默认加载全部受保护的资源(RESOURCES),同时根据(ROLES_RESOURCES)对某个角色(ROLES)对应的资源进 21 | 行划分。Spring Security 框架自动拦截全部url请求。如果发现请求的url是属于受保护的资源。要求请求用户登录系统。用户登录 22 | 时会加载对应用户角色(USERS_ROLES)。然后将请求url需要的角色与用户的角色进行对比。判断是否存在权限。 23 | 24 | ## 4.自定义监控日志-检测业务控制层的执行时间 25 | 26 | -------------------------------------------------------------------------------- /p2p.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | file://$MODULE_DIR$/src/main/resources/dispatcher-servlet.xml 22 | file://$MODULE_DIR$/src/main/resources/applicationContext-aop.xml 23 | file://$MODULE_DIR$/src/main/resources/applicationContext-dataSource.xml 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.cn.upbase 5 | p2p 6 | war 7 | 1.0-SNAPSHOT 8 | p2p Maven Webapp 9 | http://maven.apache.org 10 | 11 | 12 | 13 | p2p 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-compiler-plugin 18 | 3.1 19 | 20 | 1.7 21 | 1.7 22 | UTF-8 23 | csharp 24 | 25 | 26 | 27 | org.codehaus.plexus 28 | plexus-compiler-csharp 29 | 1.7 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.mortbay.jetty 38 | maven-jetty-plugin 39 | 6.1.2 40 | 41 | 42 | 43 | 80 44 | 45 | 46 | 10 47 | / 48 | 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-war-plugin 54 | 2.2 55 | 56 | p2p 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | ${project.basedir}/src/main/resources 66 | true 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 79 | 80 | org.springframework.security 81 | spring-security-core 82 | 3.2.8.RELEASE 83 | 84 | 85 | commons-logging 86 | commons-logging 87 | 88 | 89 | 90 | 91 | 92 | org.springframework.security 93 | spring-security-config 94 | 3.2.8.RELEASE 95 | 96 | 97 | commons-logging 98 | commons-logging 99 | 100 | 101 | 102 | 103 | 104 | org.springframework.security 105 | spring-security-web 106 | 3.2.8.RELEASE 107 | 108 | 109 | 110 | org.springframework.security 111 | spring-security-taglibs 112 | 3.2.8.RELEASE 113 | 114 | 115 | 116 | 120 | 121 | org.springframework 122 | spring-core 123 | 4.1.7.RELEASE 124 | 125 | 126 | 127 | org.springframework 128 | spring-expression 129 | 4.1.7.RELEASE 130 | 131 | 132 | 133 | org.springframework 134 | spring-beans 135 | 4.1.7.RELEASE 136 | 137 | 138 | 139 | org.springframework 140 | spring-aop 141 | 4.1.7.RELEASE 142 | 143 | 144 | 145 | org.springframework 146 | spring-context 147 | 4.1.7.RELEASE 148 | 149 | 150 | 151 | org.springframework 152 | spring-context-support 153 | 4.1.7.RELEASE 154 | 155 | 156 | 157 | org.springframework 158 | spring-tx 159 | 4.1.7.RELEASE 160 | 161 | 162 | 163 | org.springframework 164 | spring-jdbc 165 | 4.1.7.RELEASE 166 | 167 | 168 | 169 | org.springframework 170 | spring-orm 171 | 4.1.7.RELEASE 172 | 173 | 174 | 175 | org.springframework 176 | spring-web 177 | 4.1.7.RELEASE 178 | 179 | 180 | 181 | org.springframework 182 | spring-webmvc 183 | 4.1.7.RELEASE 184 | 185 | 186 | 187 | org.springframework 188 | spring-webmvc-portlet 189 | 4.1.7.RELEASE 190 | 191 | 192 | 193 | org.springframework 194 | spring-test 195 | 4.1.7.RELEASE 196 | test 197 | 198 | 199 | 200 | com.fasterxml.jackson.core 201 | jackson-core 202 | 2.6.2 203 | 204 | 205 | 206 | com.fasterxml.jackson.core 207 | jackson-databind 208 | 2.6.2 209 | 210 | 211 | 212 | org.codehaus.jackson 213 | jackson-core-asl 214 | 1.9.13 215 | 216 | 217 | 218 | org.codehaus.jackson 219 | jackson-mapper-asl 220 | 1.9.13 221 | 222 | 223 | 224 | org.aspectj 225 | aspectjweaver 226 | 1.8.6 227 | 228 | 229 | 230 | aopalliance 231 | aopalliance 232 | 1.0 233 | 234 | 235 | 236 | cglib 237 | cglib-nodep 238 | 3.1 239 | 240 | 241 | 242 | junit 243 | junit 244 | 4.11 245 | test 246 | 247 | 248 | 249 | 250 | org.mybatis 251 | mybatis-spring 252 | 1.2.3 253 | 254 | 255 | 256 | org.mybatis 257 | mybatis 258 | 3.2.8 259 | 260 | 261 | 262 | org.mybatis.generator 263 | mybatis-generator-core 264 | 1.3.2 265 | 266 | 267 | 268 | 269 | javax.servlet 270 | jstl 271 | 1.2 272 | 273 | 274 | 275 | javax.servlet 276 | servlet-api 277 | 2.5 278 | provided 279 | 280 | 281 | 282 | log4j 283 | log4j 284 | 1.2.14 285 | runtime 286 | 287 | 288 | 289 | org.slf4j 290 | slf4j-log4j12 291 | 1.7.12 292 | 293 | 294 | 295 | commons-dbcp 296 | commons-dbcp 297 | 1.4 298 | 299 | 300 | 301 | commons-pool 302 | commons-pool 303 | 1.6 304 | 305 | 306 | 307 | commons-logging 308 | commons-logging-api 309 | 1.1 310 | 311 | 312 | 313 | commons-fileupload 314 | commons-fileupload 315 | 1.3.1 316 | 317 | 318 | 319 | commons-beanutils 320 | commons-beanutils 321 | 1.9.2 322 | 323 | 324 | 325 | commons-collections 326 | commons-collections 327 | 3.2.1 328 | 329 | 330 | 331 | commons-lang 332 | commons-lang 333 | 2.6 334 | 335 | 336 | 337 | commons-httpclient 338 | commons-httpclient 339 | 3.1 340 | 341 | 342 | 343 | commons-logging 344 | commons-logging-api 345 | 1.1 346 | 347 | 348 | 349 | 350 | org.tuckey 351 | urlrewrite 352 | 2.5.2 353 | 354 | 355 | 356 | com.alibaba 357 | fastjson 358 | 1.1.31 359 | 360 | 361 | 362 | 363 | net.sf.ezmorph 364 | ezmorph 365 | 1.0.6 366 | 367 | 368 | 369 | 370 | com.jolbox 371 | bonecp 372 | 0.8.0.RELEASE 373 | 374 | 375 | 376 | com.oracle 377 | ojdbc14 378 | 10.2.0.4.0 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/aspect/SystemControllerLogger.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.aspect; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.ProceedingJoinPoint; 6 | import org.aspectj.lang.annotation.*; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.stereotype.Component; 10 | import org.springframework.web.context.request.RequestContextHolder; 11 | import org.springframework.web.context.request.ServletRequestAttributes; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpSession; 15 | import java.util.Date; 16 | 17 | 18 | /** 19 | * Created by wangpengfei on 2015/9/28. 20 | */ 21 | @Aspect 22 | @Component 23 | public class SystemControllerLogger { 24 | 25 | //本地异常日志记录对象 26 | private static final Logger logger = LoggerFactory.getLogger(SystemControllerLogger.class); 27 | 28 | //Controller层切点 29 | @Pointcut("execution(* com.sr.p2p.controller.*.*(..))") 30 | public void controllerAspect() {} 31 | 32 | //@Before("controllerAspect()") 33 | public void doBefore(JoinPoint joinPoint) {} 34 | 35 | //@After("controllerAspect()") 36 | public void doAfter(JoinPoint joinPoint) {} 37 | 38 | //@AfterThrowing(pointcut = "controllerAspect()", throwing = "e") 39 | public void doAfterThrowing(JoinPoint joinPoint, Throwable e) {} 40 | 41 | //@AfterReturning("controllerAspect()") 42 | public void readAfterReturning(){} 43 | 44 | @Around("controllerAspect()") 45 | public Object readAround(ProceedingJoinPoint joinPoint) { 46 | Date start = new Date(); 47 | Object result = null; 48 | try { 49 | result = joinPoint.proceed(joinPoint.getArgs()); 50 | } catch (Throwable e) { 51 | e.printStackTrace(); 52 | }finally{ 53 | Date end = new Date(); 54 | String params = ""; 55 | if (joinPoint.getArgs() != null && joinPoint.getArgs().length > 0) { 56 | for ( int i = 0; i < joinPoint.getArgs().length; i++) { 57 | params += JSON.toJSON(joinPoint.getArgs()[i]) + ";"; 58 | } 59 | } 60 | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); 61 | String ip = request.getRemoteAddr(); 62 | logger.info("startTime:" + start.getTime()); 63 | logger.info("method:" + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()")); 64 | logger.info("params:" + params); 65 | logger.info("iP:" + ip); 66 | logger.info("endTime:" + end.getTime()); 67 | logger.info("costTime:" +(end.getTime()-start.getTime())+" ms"); 68 | } 69 | return result; 70 | }; 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/controller/MemberController.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.controller; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestMethod; 8 | 9 | /** 10 | * Created by wangpengfei on 2015/9/28. 11 | */ 12 | @Controller 13 | @RequestMapping("member") 14 | public class MemberController { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(MemberController.class); 17 | 18 | @RequestMapping(value ="index", method = RequestMethod.GET) 19 | public String index(){ 20 | return "member/index"; 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/controller/rest/SessionController.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.controller.rest; 2 | 3 | import com.sr.p2p.controller.util.Response; 4 | import com.sr.p2p.model.User; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.security.core.Authentication; 8 | import org.springframework.security.core.context.SecurityContextHolder; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | /** 14 | * Created by wangpengfei on 2015/10/13. 15 | */ 16 | @RestController 17 | @RequestMapping("session") 18 | public class SessionController { 19 | 20 | private static final Logger logger = LoggerFactory.getLogger(SessionController.class); 21 | 22 | @RequestMapping(value ="check", method = RequestMethod.GET) 23 | public Response check(){ 24 | Response respone = new Response(); 25 | respone.setResult(false); 26 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 27 | if(authentication == null){ 28 | return respone; 29 | } 30 | if(authentication.getPrincipal() instanceof String){ 31 | return respone; 32 | } 33 | User user = (User)authentication.getPrincipal(); 34 | respone.setData(user); 35 | respone.setResult(true); 36 | return respone; 37 | }; 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/controller/util/Response.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.controller.util; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by wangpengfei on 2015/10/13. 7 | */ 8 | public class Response implements Serializable { 9 | 10 | private static final long serialVersionUID = 1985992543088976906L; 11 | 12 | private boolean result; 13 | 14 | private T data ; 15 | 16 | public boolean isResult() { 17 | return result; 18 | } 19 | 20 | public void setResult(boolean result) { 21 | this.result = result; 22 | } 23 | 24 | public T getData() { 25 | return data; 26 | } 27 | 28 | public void setData(T data) { 29 | this.data = data; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/dao/RoleResourcesMapper.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.dao; 2 | 3 | import com.sr.p2p.model.*; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | /** 10 | * Created by wangpengfei on 2015/9/28. 11 | */ 12 | @Repository("roleResourcesMapper") 13 | public interface RoleResourcesMapper { 14 | User getUserByUsername(String username); 15 | List finAllResources(); 16 | List findAllRole(); 17 | List findRoleResources(); 18 | Set findUserRoles(long userid); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/model/Resource.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by wangpengfei on 2015/10/9. 7 | */ 8 | public class Resource implements Serializable { 9 | 10 | private static final long serialVersionUID = 5033987910813241316L; 11 | 12 | private int id; 13 | 14 | private String name; 15 | 16 | private String descript; 17 | 18 | private String url; 19 | 20 | private int type; 21 | 22 | public int getId() { 23 | return id; 24 | } 25 | 26 | public void setId(int id) { 27 | this.id = id; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | public String getDescript() { 39 | return descript; 40 | } 41 | 42 | public void setDescript(String descript) { 43 | this.descript = descript; 44 | } 45 | 46 | public String getUrl() { 47 | return url; 48 | } 49 | 50 | public void setUrl(String url) { 51 | this.url = url; 52 | } 53 | 54 | public int getType() { 55 | return type; 56 | } 57 | 58 | public void setType(int type) { 59 | this.type = type; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/model/Role.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Set; 5 | 6 | /** 7 | * Created by wangpengfei on 2015/10/9. 8 | */ 9 | public class Role implements Serializable { 10 | 11 | 12 | private static final long serialVersionUID = -8560134472837804097L; 13 | 14 | private int id; 15 | 16 | private String name; 17 | 18 | private String descript; 19 | 20 | private int type; 21 | 22 | private Set resources; 23 | 24 | public int getId() { 25 | return id; 26 | } 27 | 28 | public void setId(int id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | 40 | public String getDescript() { 41 | return descript; 42 | } 43 | 44 | public void setDescript(String descript) { 45 | this.descript = descript; 46 | } 47 | 48 | public int getType() { 49 | return type; 50 | } 51 | 52 | public void setType(int type) { 53 | this.type = type; 54 | } 55 | 56 | public Set getResources() { 57 | return resources; 58 | } 59 | 60 | public void setResources(Set resources) { 61 | this.resources = resources; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/model/RoleResource.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by wangpengfei on 2015/10/10. 7 | */ 8 | public class RoleResource implements Serializable { 9 | private static final long serialVersionUID = 8318483417201256211L; 10 | private int roleId; 11 | private int resourceId; 12 | 13 | public int getRoleId() { 14 | return roleId; 15 | } 16 | 17 | public void setRoleId(int roleId) { 18 | this.roleId = roleId; 19 | } 20 | 21 | public int getResourceId() { 22 | return resourceId; 23 | } 24 | 25 | public void setResourceId(int resourceId) { 26 | this.resourceId = resourceId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sr.p2p.model; 17 | 18 | 19 | import org.springframework.security.crypto.password.PasswordEncoder; 20 | 21 | 22 | import java.io.Serializable; 23 | import java.util.Set; 24 | 25 | /** 26 | * Represents a user in our system. 27 | * 28 | *

29 | * In a real system use {@link PasswordEncoder} to ensure the password is secured 30 | * properly. This demonstration does not address this due to time restrictions. 31 | *

32 | * 33 | * @author Rob Winch 34 | */ 35 | 36 | public class User implements Serializable { 37 | 38 | private static final long serialVersionUID = -6540780111618159858L; 39 | 40 | private Long id; 41 | private String firstName; 42 | private String lastName; 43 | private String email; 44 | private String password; 45 | private String userName; 46 | 47 | private int isAccountNonExpired; 48 | private int isAccountNonLocked; 49 | private int isCredentialsNonExpired; 50 | private int isEnabled; 51 | 52 | Set roles; 53 | 54 | public User() { 55 | } 56 | 57 | public User(User user) { 58 | this.id = user.id; 59 | this.firstName = user.firstName; 60 | this.lastName = user.lastName; 61 | this.email = user.email; 62 | this.password = user.password; 63 | this.userName= user.userName; 64 | } 65 | 66 | public String getPassword() { 67 | return password; 68 | } 69 | 70 | public void setPassword(String password) { 71 | this.password = password; 72 | } 73 | 74 | public Long getId() { 75 | return id; 76 | } 77 | 78 | public void setId(Long id) { 79 | this.id = id; 80 | } 81 | 82 | public String getFirstName() { 83 | return firstName; 84 | } 85 | 86 | public void setFirstName(String firstName) { 87 | this.firstName = firstName; 88 | } 89 | 90 | public String getLastName() { 91 | return lastName; 92 | } 93 | 94 | public void setLastName(String lastName) { 95 | this.lastName = lastName; 96 | } 97 | 98 | public String getEmail() { 99 | return email; 100 | } 101 | 102 | public void setEmail(String email) { 103 | this.email = email; 104 | } 105 | 106 | @Override 107 | public int hashCode() { 108 | final int prime = 31; 109 | int result = 1; 110 | result = prime * result + ((id == null) ? 0 : id.hashCode()); 111 | return result; 112 | } 113 | 114 | @Override 115 | public boolean equals(Object obj) { 116 | if (this == obj) 117 | return true; 118 | if (obj == null) 119 | return false; 120 | if (getClass() != obj.getClass()) 121 | return false; 122 | User other = (User) obj; 123 | if (id == null) { 124 | if (other.id != null) 125 | return false; 126 | } 127 | else if (!id.equals(other.id)) 128 | return false; 129 | return true; 130 | } 131 | 132 | public Set getRoles() { 133 | return roles; 134 | } 135 | 136 | public void setRoles(Set roles) { 137 | this.roles = roles; 138 | } 139 | 140 | public String getUserName() { 141 | return userName; 142 | } 143 | 144 | public void setUserName(String userName) { 145 | this.userName = userName; 146 | } 147 | 148 | public int getIsAccountNonExpired() { 149 | return isAccountNonExpired; 150 | } 151 | 152 | public void setIsAccountNonExpired(int isAccountNonExpired) { 153 | this.isAccountNonExpired = isAccountNonExpired; 154 | } 155 | 156 | public int getIsAccountNonLocked() { 157 | return isAccountNonLocked; 158 | } 159 | 160 | public void setIsAccountNonLocked(int isAccountNonLocked) { 161 | this.isAccountNonLocked = isAccountNonLocked; 162 | } 163 | 164 | public int getIsCredentialsNonExpired() { 165 | return isCredentialsNonExpired; 166 | } 167 | 168 | public void setIsCredentialsNonExpired(int isCredentialsNonExpired) { 169 | this.isCredentialsNonExpired = isCredentialsNonExpired; 170 | } 171 | 172 | public int getIsEnabled() { 173 | return isEnabled; 174 | } 175 | 176 | public void setIsEnabled(int isEnabled) { 177 | this.isEnabled = isEnabled; 178 | } 179 | } -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/model/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by wangpengfei on 2015/10/10. 7 | */ 8 | public class UserRole implements Serializable { 9 | private static final long serialVersionUID = 2469464498136933424L; 10 | private int userId; 11 | private int roleId; 12 | 13 | public int getUserId() { 14 | return userId; 15 | } 16 | 17 | public void setUserId(int userId) { 18 | this.userId = userId; 19 | } 20 | 21 | public int getRoleId() { 22 | return roleId; 23 | } 24 | 25 | public void setRoleId(int roleId) { 26 | this.roleId = roleId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/security/P2PAccessDecisionManager.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.security; 2 | 3 | import org.springframework.security.access.AccessDecisionManager; 4 | import org.springframework.security.access.AccessDeniedException; 5 | import org.springframework.security.access.ConfigAttribute; 6 | import org.springframework.security.authentication.InsufficientAuthenticationException; 7 | import org.springframework.security.core.Authentication; 8 | import org.springframework.security.core.GrantedAuthority; 9 | 10 | import java.util.Collection; 11 | import java.util.Iterator; 12 | 13 | /** 14 | * Created by wangpengfei on 2015/10/9. 15 | */ 16 | public class P2PAccessDecisionManager implements AccessDecisionManager { 17 | 18 | @Override 19 | public void decide(Authentication authentication, Object o, Collection collection) throws AccessDeniedException, InsufficientAuthenticationException { 20 | if(collection == null) { 21 | return; 22 | } 23 | //用户请求url需要对应的角色 24 | Iterator iterator = collection.iterator(); 25 | while(iterator.hasNext()) { 26 | ConfigAttribute configAttribute = iterator.next(); 27 | String needPermission = configAttribute.getAttribute(); 28 | //用户角色与访问连接角色对比 29 | for(GrantedAuthority ga : authentication.getAuthorities()) { 30 | if(needPermission.equals(ga.getAuthority())) { 31 | return; 32 | } 33 | } 34 | } 35 | throw new AccessDeniedException("没有权限访问!"); 36 | } 37 | 38 | @Override 39 | public boolean supports(ConfigAttribute configAttribute) { 40 | return true; 41 | } 42 | 43 | @Override 44 | public boolean supports(Class aClass) { 45 | return true; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/security/P2PBeforeSecurityInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.security; 2 | 3 | import org.springframework.security.access.SecurityMetadataSource; 4 | import org.springframework.security.access.intercept.AbstractSecurityInterceptor; 5 | import org.springframework.security.access.intercept.InterceptorStatusToken; 6 | import org.springframework.security.web.FilterInvocation; 7 | import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; 8 | 9 | 10 | import javax.servlet.*; 11 | import java.io.IOException; 12 | import java.util.logging.LogRecord; 13 | 14 | /** 15 | * Created by wangpengfei on 2015/10/9. 16 | */ 17 | public class P2PBeforeSecurityInterceptor extends AbstractSecurityInterceptor implements Filter { 18 | 19 | private FilterInvocationSecurityMetadataSource securityMetadataSource; 20 | 21 | @Override 22 | public Class getSecureObjectClass() { 23 | return FilterInvocation.class; 24 | } 25 | 26 | @Override 27 | public SecurityMetadataSource obtainSecurityMetadataSource() { 28 | return this.securityMetadataSource; 29 | } 30 | 31 | @Override 32 | public void init(FilterConfig filterConfig) throws ServletException { 33 | 34 | } 35 | 36 | @Override 37 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 38 | FilterInvocation fi = new FilterInvocation(servletRequest, servletResponse, filterChain); 39 | invoke(fi); 40 | } 41 | 42 | private void invoke(FilterInvocation fi) throws IOException, ServletException { 43 | InterceptorStatusToken token = super.beforeInvocation(fi); 44 | try { 45 | fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); 46 | } finally { 47 | super.afterInvocation(token, null); 48 | } 49 | } 50 | 51 | @Override 52 | public void destroy() { 53 | 54 | } 55 | 56 | public FilterInvocationSecurityMetadataSource getSecurityMetadataSource() { 57 | return securityMetadataSource; 58 | } 59 | 60 | public void setSecurityMetadataSource(FilterInvocationSecurityMetadataSource securityMetadataSource) { 61 | this.securityMetadataSource = securityMetadataSource; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/security/P2PFilterInvocationSecurityMetadataSource.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.security; 2 | 3 | import com.sr.p2p.model.Resource; 4 | import com.sr.p2p.model.RoleResource; 5 | import com.sr.p2p.service.RoleResourcesService; 6 | import org.springframework.security.access.ConfigAttribute; 7 | import org.springframework.security.access.SecurityConfig; 8 | import org.springframework.security.web.FilterInvocation; 9 | import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; 10 | 11 | import java.util.*; 12 | 13 | /** 14 | * Created by wangpengfei on 2015/10/9. 15 | */ 16 | public class P2PFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource { 17 | 18 | private RoleResourcesService roleResourcesService; 19 | 20 | //角色-资源数据 21 | public static Map> roleResouces = null; 22 | 23 | //资源数据 24 | private static Map> resourceMap = null; 25 | 26 | 27 | public P2PFilterInvocationSecurityMetadataSource (RoleResourcesService roleResourcesService){ 28 | this.roleResourcesService = roleResourcesService; 29 | loadResourceDefine(); 30 | } 31 | 32 | 33 | @Override 34 | public Collection getAllConfigAttributes() { 35 | return null; 36 | } 37 | 38 | @Override 39 | public boolean supports(Class aClass) { 40 | return true; 41 | } 42 | 43 | //系统启动时默认加载全部资源和 资源和角色的对应关系 44 | private void loadResourceDefine() { 45 | 46 | if(resourceMap == null) { 47 | 48 | resourceMap = new HashMap>(); 49 | roleResouces = new HashMap>(); 50 | 51 | //全部资源 52 | List resources = this.roleResourcesService.findAll(); 53 | //key = 角色id ,value = 角色详情 54 | Map temp = new HashMap(); 55 | 56 | for (Resource resource : resources) { 57 | Collection configAttributes = new ArrayList(); 58 | ConfigAttribute configAttribute = new SecurityConfig(resource.getName()); 59 | configAttributes.add(configAttribute); 60 | temp.put(resource.getId(),resource); 61 | resourceMap.put(resource.getUrl(), configAttributes); 62 | } 63 | //全部角色对应资源 64 | List roleResources = this.roleResourcesService.findRoleResources(); 65 | 66 | for (RoleResource roleResource:roleResources){ 67 | if(roleResouces.get(roleResource.getRoleId()) !=null){ 68 | roleResouces.get(roleResource.getRoleId()).add(temp.get(roleResource.getResourceId())); 69 | }else{ 70 | Set res = new HashSet(); 71 | res.add(temp.get(roleResource.getResourceId())); 72 | roleResouces.put(roleResource.getRoleId(),res); 73 | } 74 | } 75 | 76 | } 77 | } 78 | 79 | 80 | @Override 81 | public Collection getAttributes(Object object) throws IllegalArgumentException { 82 | String requestUrl = ((FilterInvocation) object).getRequestUrl(); 83 | if(resourceMap == null) { 84 | loadResourceDefine(); 85 | } 86 | return resourceMap.get(requestUrl); 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/security/P2PUserDetailsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.sr.p2p.security; 17 | 18 | import com.sr.p2p.model.Resource; 19 | import com.sr.p2p.model.User; 20 | import com.sr.p2p.model.UserRole; 21 | import com.sr.p2p.service.RoleResourcesService; 22 | import org.springframework.security.core.GrantedAuthority; 23 | import org.springframework.security.core.authority.GrantedAuthorityImpl; 24 | import org.springframework.security.core.userdetails.UserDetails; 25 | import org.springframework.security.core.userdetails.UserDetailsService; 26 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 27 | 28 | 29 | import java.util.Collection; 30 | import java.util.HashSet; 31 | import java.util.Set; 32 | 33 | /** 34 | * @author Rob Winch 35 | * 36 | */ 37 | public class P2PUserDetailsService implements UserDetailsService { 38 | 39 | RoleResourcesService roleResourcesService; 40 | 41 | /* 42 | * (non-Javadoc) 43 | * 44 | * @see 45 | * org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername 46 | * (java.lang.String) 47 | */ 48 | public UserDetails loadUserByUsername(String username) 49 | throws UsernameNotFoundException { 50 | User user = roleResourcesService.getUserByUsername(username); 51 | if (user == null) { 52 | throw new UsernameNotFoundException("Could not find user " + username); 53 | } 54 | Set roles = roleResourcesService.findUserRoles(user.getId()); 55 | user.setRoles(roles); 56 | //用户权限 57 | Collection grantedAuths = obtionGrantedAuthorities(user); 58 | return new CustomUserDetails(user,grantedAuths); 59 | } 60 | 61 | private final static class CustomUserDetails extends User implements UserDetails { 62 | 63 | private static final long serialVersionUID = -1003195756083273443L; 64 | 65 | Collection grantedAuths = null; 66 | 67 | private CustomUserDetails(User user,Collection grantedAuths) { 68 | super(user); 69 | this.grantedAuths = grantedAuths; 70 | } 71 | 72 | public Collection getAuthorities() { 73 | return grantedAuths; 74 | } 75 | 76 | public String getUsername() { 77 | return getUserName(); 78 | } 79 | 80 | public boolean isAccountNonExpired() { 81 | return getIsAccountNonExpired() > 0 ? false : true; 82 | } 83 | 84 | public boolean isAccountNonLocked() { 85 | return getIsAccountNonLocked() > 0 ? false : true; 86 | } 87 | 88 | public boolean isCredentialsNonExpired() { 89 | return getIsCredentialsNonExpired() > 0 ? false : true; 90 | } 91 | 92 | public boolean isEnabled() { 93 | return getIsEnabled() > 0 ? false : true; 94 | } 95 | } 96 | 97 | //加载用户权限 98 | private Set obtionGrantedAuthorities(User user) { 99 | Set authSet = new HashSet(); 100 | Set roles = user.getRoles(); 101 | for(UserRole role : roles) { 102 | //用户角色对应的资源 103 | Set tempRes = P2PFilterInvocationSecurityMetadataSource.roleResouces.get(role.getRoleId()); 104 | //认证用户角色 105 | for(Resource res : tempRes) { 106 | authSet.add(new GrantedAuthorityImpl(res.getName())); 107 | } 108 | } 109 | return authSet; 110 | } 111 | 112 | public RoleResourcesService getRoleResourcesService() { 113 | return roleResourcesService; 114 | } 115 | 116 | public void setRoleResourcesService(RoleResourcesService roleResourcesService) { 117 | this.roleResourcesService = roleResourcesService; 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/security/P2PUsernamePasswordAuthenticationFilter.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.security; 2 | 3 | import org.springframework.security.authentication.AuthenticationServiceException; 4 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 5 | import org.springframework.security.core.Authentication; 6 | import org.springframework.security.core.AuthenticationException; 7 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | 14 | /** 15 | * Created by wangpengfei on 2015/10/8. 16 | */ 17 | public class P2PUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter { 18 | 19 | private boolean postOnly = true; 20 | 21 | public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { 22 | if(this.postOnly && !request.getMethod().equals("POST")) { 23 | throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); 24 | } else { 25 | String username = this.obtainUsername(request); 26 | String password = this.obtainPassword(request); 27 | if(username == null) { 28 | username = ""; 29 | } 30 | 31 | if(password == null) { 32 | password = ""; 33 | } 34 | username = username.trim(); 35 | UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); 36 | this.setDetails(request, authRequest); 37 | return this.getAuthenticationManager().authenticate(authRequest); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/service/RoleResourcesService.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.service; 2 | 3 | import com.sr.p2p.model.*; 4 | 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | /** 9 | * Created by wangpengfei on 2015/9/28. 10 | */ 11 | public interface RoleResourcesService { 12 | 13 | User getUserByUsername(String username); 14 | 15 | List findAll(); 16 | 17 | List findAllRole(); 18 | 19 | List findRoleResources(); 20 | 21 | Set findUserRoles(long userid); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/sr/p2p/service/impl/RoleResourcesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sr.p2p.service.impl; 2 | 3 | import com.sr.p2p.dao.RoleResourcesMapper; 4 | import com.sr.p2p.model.*; 5 | import com.sr.p2p.service.RoleResourcesService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | import java.util.Set; 11 | 12 | /** 13 | * Created by wangpengfei on 2015/9/28. 14 | */ 15 | @Service() 16 | public class RoleResourcesServiceImpl implements RoleResourcesService { 17 | 18 | @Autowired 19 | private RoleResourcesMapper roleResourcesMapper; 20 | 21 | @Override 22 | public User getUserByUsername(String username) { 23 | return roleResourcesMapper.getUserByUsername(username); 24 | } 25 | 26 | @Override 27 | public List findAll() { 28 | return roleResourcesMapper.finAllResources(); 29 | } 30 | 31 | @Override 32 | public List findAllRole() { 33 | return roleResourcesMapper.findAllRole(); 34 | } 35 | 36 | @Override 37 | public List findRoleResources() { 38 | return roleResourcesMapper.findRoleResources(); 39 | } 40 | 41 | @Override 42 | public Set findUserRoles(long userid) { 43 | return roleResourcesMapper.findUserRoles(userid); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext-dataSource.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext-logger.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext-security.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /src/main/resources/dispatcher-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | ### set log levels ### 2 | log4j.rootLogger = info , stdout , file , error 3 | 4 | ### \u8F93\u51FA\u5230\u63A7\u5236\u53F0 ### 5 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.Target = System.out 7 | log4j.appender.stdout.Encoding=UTF-8 8 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n 10 | 11 | ### \u8F93\u51FA\u5230\u65E5\u5FD7\u6587\u4EF6 ### 12 | log4j.appender.file = org.apache.log4j.DailyRollingFileAppender 13 | log4j.appender.file.File = /home/logs/p2p-info.log 14 | log4j.appender.file.Encoding=UTF-8 15 | log4j.appender.file.Append = true 16 | ## \u8F93\u51FADEBUG\u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD7 17 | log4j.appender.file.Threshold = INFO 18 | log4j.appender.file.layout = org.apache.log4j.PatternLayout 19 | log4j.appender.file.layout.ConversionPattern = %-d{yyyy-MM-dd HH\:mm\:ss} [ %c{1} ] - [ %p ] %m%n 20 | 21 | ### \u4FDD\u5B58\u5F02\u5E38\u4FE1\u606F\u5230\u5355\u72EC\u6587\u4EF6 ### 22 | log4j.appender.error = org.apache.log4j.DailyRollingFileAppender 23 | ## \u5F02\u5E38\u65E5\u5FD7\u6587\u4EF6\u540D 24 | log4j.appender.error.File = /home/logs/p2p-error.log 25 | log4j.appender.error.Append = true 26 | log4j.appender.error.Encoding=UTF-8 27 | ## \u53EA\u8F93\u51FAERROR\u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD7!!! 28 | log4j.appender.error.Threshold = ERROR 29 | log4j.appender.error.layout = org.apache.log4j.PatternLayout 30 | log4j.appender.error.layout.ConversionPattern = %-d{yyyy-MM-dd HH\:mm\:ss} [ %c{1} ] - [ %p ] %m%n 31 | 32 | ## Mybatis\u65E5\u5FD7 33 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 34 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 35 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n 36 | 37 | log4j.logger.com.ibatis=debug 38 | log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=debug 39 | log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug 40 | log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug 41 | log4j.logger.java.sql.Connection=debug 42 | log4j.logger.java.sql.Statement=debug 43 | log4j.logger.java.sql.PreparedStatement=debug,stdout 44 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 45 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 46 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n 47 | -------------------------------------------------------------------------------- /src/main/resources/mapper/RoleResourcesMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 46 | 47 | 50 | 51 | 54 | 55 | 58 | 59 | 62 | 63 | -------------------------------------------------------------------------------- /src/main/resources/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | p2p 8 | 9 | 10 | 11 | contextConfigLocation 12 | 13 | classpath:applicationContext*.xml 14 | 15 | 16 | 17 | 18 | 19 | 20 | log4jConfigLocation 21 | classpath:log4j.properties 22 | 23 | 24 | 25 | log4jRefreshInterval 26 | 60000 27 | 28 | 29 | 30 | 31 | 32 | org.springframework.web.context.ContextLoaderListener 33 | 34 |    35 | 36 | org.springframework.security.web.session.HttpSessionEventPublisher 37 | 38 | 39 | 40 | org.springframework.web.util.Log4jConfigListener 41 | 42 | 43 | 44 | 45 | dispatcher 46 | org.springframework.web.servlet.DispatcherServlet 47 | 48 | contextConfigLocation 49 | classpath:dispatcher-servlet.xml 50 | 51 | 1 52 | 53 | 54 | 55 | dispatcher 56 | *.do 57 | 58 | 59 | 60 | 61 | 62 | encodingFilter 63 | org.springframework.web.filter.CharacterEncodingFilter 64 | 65 | encoding 66 | UTF-8 67 | 68 | 69 | 70 | 71 | encodingFilter 72 | /* 73 | 74 | 75 | 76 | 77 | 78 | springSecurityFilterChain 79 | org.springframework.web.filter.DelegatingFilterProxy 80 | 81 | 82 | 83 | springSecurityFilterChain 84 | /* 85 | 86 | 87 | 88 | 60 89 | 90 | 91 | 92 | 93 | index.html 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | P2P 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 58 | 59 | 60 | 62 | 110 | 111 | 112 | 114 | 115 | 116 |
117 | 118 | 122 | 123 |
124 |
季度金150924-06
125 |
秒杀投资用户专享
126 |
127 | 128 |
129 |
月满金
130 |
季度金
131 |
金元宝
132 |
133 | 134 | 135 |
136 | 137 | 138 |
139 | 140 |
141 | 142 |
143 |

投资项目

144 |

经过专业公司/担保公司、信用评级机构、金信风控部门三层审查合格的投资计划

145 |
146 |
147 | 148 | 系统公告 149 | 150 |
151 |
152 | 153 | 154 |
155 | 156 | 157 |
158 | 159 |
160 | 161 |
162 | 我们如何为您带来收益 163 | 开创崭新的投资渠道,降低投资门槛和成本,让任何人都能成为专业投资者 164 |
165 | 166 |
167 | 168 | 169 |
170 | 171 | 172 |
173 | 174 |
175 | 176 |
177 | 支持我们的合作伙伴 178 | 金信网首当行业先锋,率先加入中国互联网金融行业协会 179 |
180 | 181 |
182 | 183 | 184 |
185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /src/main/webapp/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

login

9 |
10 | 11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /src/main/webapp/static/css/img/carousel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/main/webapp/static/css/img/carousel.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/css/moudle/carousel/carousel.css: -------------------------------------------------------------------------------- 1 | /* GLOBAL STYLES 2 | -------------------------------------------------- */ 3 | /* Padding below the footer and lighter body text */ 4 | 5 | body { 6 | padding-bottom: 40px; 7 | color: #5a5a5a; 8 | } 9 | 10 | 11 | /* CUSTOMIZE THE NAVBAR 12 | -------------------------------------------------- */ 13 | 14 | /* Special class on .container surrounding .navbar, used for positioning it into place. */ 15 | .navbar-wrapper { 16 | position: absolute; 17 | top: 0; 18 | right: 0; 19 | left: 0; 20 | z-index: 20; 21 | } 22 | 23 | /* Flip around the padding for proper display in narrow viewports */ 24 | .navbar-wrapper > .container { 25 | padding-right: 0; 26 | padding-left: 0; 27 | } 28 | .navbar-wrapper .navbar { 29 | padding-right: 15px; 30 | padding-left: 15px; 31 | } 32 | .navbar-wrapper .navbar .container { 33 | width: auto; 34 | } 35 | 36 | 37 | /* CUSTOMIZE THE CAROUSEL 38 | -------------------------------------------------- */ 39 | 40 | /* Carousel base class */ 41 | .carousel { 42 | height: 350px; 43 | margin-bottom: 60px; 44 | } 45 | /* Since positioning the image, we need to help out the caption */ 46 | .carousel-caption { 47 | z-index: 10; 48 | } 49 | 50 | /* Declare heights because of positioning of img element */ 51 | .carousel .item { 52 | height: 350px; 53 | background-color: #777; 54 | } 55 | .carousel-inner > .item > img { 56 | position: absolute; 57 | top: 0; 58 | left: 0; 59 | min-width: 100%; 60 | min-height: 100%; 61 | } 62 | 63 | 64 | /* MARKETING CONTENT 65 | -------------------------------------------------- */ 66 | 67 | /* Center align the text within the three columns below the carousel */ 68 | .marketing .col-lg-4 { 69 | margin-bottom: 20px; 70 | text-align: center; 71 | } 72 | .marketing h2 { 73 | font-weight: normal; 74 | } 75 | .marketing .col-lg-4 p { 76 | margin-right: 10px; 77 | margin-left: 10px; 78 | } 79 | 80 | 81 | /* Featurettes 82 | ------------------------- */ 83 | 84 | .featurette-divider { 85 | margin: 80px 0; /* Space out the Bootstrap
more */ 86 | } 87 | 88 | /* Thin out the marketing headings */ 89 | .featurette-heading { 90 | font-weight: 300; 91 | line-height: 1; 92 | letter-spacing: -1px; 93 | } 94 | 95 | 96 | /* RESPONSIVE CSS 97 | -------------------------------------------------- */ 98 | 99 | @media (min-width: 768px) { 100 | /* Navbar positioning foo */ 101 | .navbar-wrapper { 102 | margin-top: 20px; 103 | } 104 | .navbar-wrapper .container { 105 | padding-right: 15px; 106 | padding-left: 15px; 107 | } 108 | .navbar-wrapper .navbar { 109 | padding-right: 0; 110 | padding-left: 0; 111 | } 112 | 113 | /* The navbar becomes detached from the top, so we round the corners */ 114 | .navbar-wrapper .navbar { 115 | border-radius: 4px; 116 | } 117 | 118 | /* Bump up size of carousel content */ 119 | .carousel-caption p { 120 | margin-bottom: 20px; 121 | font-size: 21px; 122 | line-height: 1.4; 123 | } 124 | 125 | .featurette-heading { 126 | font-size: 50px; 127 | } 128 | } 129 | 130 | @media (min-width: 992px) { 131 | .featurette-heading { 132 | margin-top: 120px; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /src/main/webapp/static/css/moudle/grid/grid.css: -------------------------------------------------------------------------------- 1 | h4 { 2 | margin-top: 25px; 3 | } 4 | .row { 5 | margin-bottom: 20px; 6 | } 7 | .row .row { 8 | margin-top: 10px; 9 | margin-bottom: 0; 10 | } 11 | [class*="col-"] { 12 | padding-top: 15px; 13 | padding-bottom: 15px; 14 | background-color: #fff; 15 | background-color: rgba(86,61,124,.15); 16 | border: 1px solid #fff; 17 | border: 1px solid rgba(86,61,124,.2); 18 | } 19 | 20 | hr { 21 | margin-top: 40px; 22 | margin-bottom: 40px; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/webapp/static/script/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.5 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under the MIT license 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.5",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.5",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.5",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.5",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.5",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.5",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.5",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); -------------------------------------------------------------------------------- /src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/main/webapp/static/script/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/webapp/static/script/require-setup.js: -------------------------------------------------------------------------------- 1 | requirejs.config({ 2 | 3 | baseUrl: 'static/script/', 4 | 5 | urlArgs: 'ver=20151019', 6 | 7 | shim : { 8 | "bootstrap" : { "deps" :['jquery'] } 9 | }, 10 | 11 | paths: { 12 | // the left side is the module ID,the right side is the path to 13 | jquery: 'jquery-1.11.3.min', 14 | bootstrap:'bootstrap.min', 15 | navbar:'widget/navbar' 16 | } 17 | 18 | }); -------------------------------------------------------------------------------- /src/main/webapp/static/script/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.20 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||e.onError!==ca)try{f=h.execCb(c,l,b,f)}catch(d){a=d}else f=h.execCb(c,l,b,f);this.map.isDefine&& 19 | void 0===f&&((b=this.module)?f=b.exports:this.usingExports&&(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(q[c]=f,e.onResourceLoad))e.onResourceLoad(h,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete= 20 | !0)}}else t(h.defQueueMap,c)||this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=i(a.prefix);this.depMaps.push(d);s(d,"defined",u(this,function(f){var l,d;d=n(aa,this.map.id);var g=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,p=h.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(g=f.normalize(g,function(a){return c(a,P,!0)})||""),f=i(a.prefix+"!"+g,this.map.parentMap),s(f,"defined",u(this,function(a){this.init([],function(){return a}, 21 | null,{enabled:!0,ignore:!0})})),d=n(m,f.id)){this.depMaps.push(f);if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=h.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];A(m,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,g=i(d),P=M;c&&(f=c);P&& 22 | (M=!1);r(g);t(k.config,b)&&(k.config[d]=k.config[b]);try{e.exec(f)}catch(m){return w(B("fromtexteval","fromText eval for "+b+" failed: "+m,m,[b]))}P&&(M=!0);this.depMaps.push(g);h.completeLoad(d);p([d],l)}),f.load(a.name,p,l,k))}));h.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=i(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c= 23 | n(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",u(this,function(a){this.undefed||(this.defineDep(b,a),this.check())}));this.errback?s(a,"error",u(this,this.errback)):this.events.error&&s(a,"error",u(this,function(a){this.emit("error",a)}))}c=a.id;f=m[c];!t(L,c)&&(f&&!f.enabled)&&h.enable(a,this)}));A(this.pluginMaps,u(this,function(a){var b=n(m,a.id);b&&!b.enabled&&h.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]= 24 | []);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};h={config:k,contextName:b,registry:m,defined:q,urlFetched:S,defQueue:C,defQueueMap:{},Module:Z,makeModuleMap:i,nextTick:e.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=k.shim,c={paths:!0,bundles:!0,config:!0,map:!0};A(a,function(a,b){c[b]?(k[b]||(k[b]={}),U(k[b],a,!0,!0)):k[b]=a});a.bundles&&A(a.bundles,function(a,b){v(a, 25 | function(a){a!==b&&(aa[a]=b)})});a.shim&&(A(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=h.makeShimExports(a);b[c]=a}),k.shim=b);a.packages&&v(a.packages,function(a){var b,a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(k.paths[b]=a.location);k.pkgs[b]=a.name+"/"+(a.main||"main").replace(ha,"").replace(Q,"")});A(m,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=i(b,null,!0))});if(a.deps||a.callback)h.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b; 26 | a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,j){function g(c,d,p){var k,n;j.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild=!0);if("string"===typeof c){if(G(d))return w(B("requireargs","Invalid require call"),p);if(a&&t(L,c))return L[c](m[a.id]);if(e.get)return e.get(h,c,a,g);k=i(c,a,!1,!0);k=k.id;return!t(q,k)?w(B("notloaded",'Module name "'+k+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):q[k]}J();h.nextTick(function(){J(); 27 | n=r(i(null,a));n.skipMap=j.skipMap;n.init(c,d,p,{enabled:!0});D()});return g}j=j||{};U(g,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),j=b.split("/")[0];if(-1!==e&&(!("."===j||".."===j)||1g.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1));g.src=d;J=g;D?y.insertBefore(g,D):y.appendChild(g);J=null;return g}if(ea)try{importScripts(d),b.completeLoad(c)}catch(i){b.onError(B("importscripts", 35 | "importScripts failed for "+c+" at "+d,i,[c]))}};z&&!s.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return r=I,s.baseUrl||(E=r.split("/"),r=E.pop(),O=E.length?E.join("/")+"/":"./",s.baseUrl=O),r=r.replace(Q,""),e.jsExtRegExp.test(r)&&(r=I),s.deps=s.deps?s.deps.concat(r):[r],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ja,"").replace(ka, 36 | function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b||(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}g?(g.defQueue.push([b,c,d]),g.defQueueMap[b]=!0):R.push([b,c,d])};define.amd={jQuery:!0};e.exec=function(b){return eval(b)};e(s)}})(this); 37 | -------------------------------------------------------------------------------- /src/main/webapp/static/script/view/index.js: -------------------------------------------------------------------------------- 1 | require(['jquery', 'bootstrap','navbar'], function($,m1,navbar){ 2 | 3 | //检测用户登录 session 4 | navbar.checkSession(); 5 | 6 | 7 | }); -------------------------------------------------------------------------------- /src/main/webapp/static/script/widget/navbar.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | 3 | var $ = require('jquery'); 4 | //导航栏 5 | function navbar(){ 6 | this.login = $("#navbar-login"); 7 | this.loginOut = $("#navbar-loginout"); 8 | this.userName = $("#navbar-username"); 9 | } 10 | 11 | //检测用户登录 session 12 | navbar.prototype.checkSession = function(){ 13 | var $_navbar = this; 14 | $.ajax({url: "session/check.do", 15 | dataType: "json", 16 | success: function(data){ 17 | if(data.result){ 18 | $_navbar.loginOut.show(); 19 | $_navbar.userName.find('a').html(data.data.userName) 20 | $_navbar.userName.show(); 21 | }else{ 22 | $_navbar.login.show(); 23 | } 24 | } 25 | }); 26 | } 27 | 28 | //导航栏初始化 29 | navbar.prototype.init = function(){ 30 | //this.checkSession(); 31 | } 32 | 33 | return new navbar(); 34 | 35 | }); -------------------------------------------------------------------------------- /src/main/webapp/static/view/member/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | This member's index page 9 | 10 | -------------------------------------------------------------------------------- /src/test/java/database/records.sql: -------------------------------------------------------------------------------- 1 | prompt PL/SQL Developer import file 2 | prompt Created on 2015年10月10日 by wangpengfei 3 | set feedback off 4 | set define off 5 | prompt Disabling triggers for RESOURCES... 6 | alter table RESOURCES disable all triggers; 7 | prompt Disabling triggers for ROLES... 8 | alter table ROLES disable all triggers; 9 | prompt Disabling triggers for ROLES_RESOURCES... 10 | alter table ROLES_RESOURCES disable all triggers; 11 | prompt Disabling triggers for USERS... 12 | alter table USERS disable all triggers; 13 | prompt Disabling triggers for USERS_ROLES... 14 | alter table USERS_ROLES disable all triggers; 15 | prompt Deleting USERS_ROLES... 16 | delete from USERS_ROLES; 17 | commit; 18 | prompt Deleting USERS... 19 | delete from USERS; 20 | commit; 21 | prompt Deleting ROLES_RESOURCES... 22 | delete from ROLES_RESOURCES; 23 | commit; 24 | prompt Deleting ROLES... 25 | delete from ROLES; 26 | commit; 27 | prompt Deleting RESOURCES... 28 | delete from RESOURCES; 29 | commit; 30 | prompt Loading RESOURCES... 31 | insert into RESOURCES (id, name, descript, url, type) 32 | values (2, 'admin', '管理员', '/admin/index.do', 0); 33 | insert into RESOURCES (id, name, descript, url, type) 34 | values (3, 'member', '普通用户', '/member/index.do', 0); 35 | commit; 36 | prompt 2 records loaded 37 | prompt Loading ROLES... 38 | insert into ROLES (id, name, descript, type) 39 | values (2, 'admin', '管理员', 0); 40 | insert into ROLES (id, name, descript, type) 41 | values (3, 'member', '普通用户', 0); 42 | commit; 43 | prompt 2 records loaded 44 | prompt Loading ROLES_RESOURCES... 45 | insert into ROLES_RESOURCES (role_id, resource_id) 46 | values (2, 2); 47 | insert into ROLES_RESOURCES (role_id, resource_id) 48 | values (3, 3); 49 | commit; 50 | prompt 2 records loaded 51 | prompt Loading USERS... 52 | insert into USERS (id, firstname, lastname, email, password, username, isaccountnonexpired, isaccountnonlocked, iscredentialsnonexpired, isenabled) 53 | values (2, '鹏飞', '王', '13522921121@163.com', '111111', '13522921121', 0, 0, 0, 0); 54 | commit; 55 | prompt 1 records loaded 56 | prompt Loading USERS_ROLES... 57 | insert into USERS_ROLES (user_id, role_id) 58 | values (2, 3); 59 | commit; 60 | prompt 1 records loaded 61 | prompt Enabling triggers for RESOURCES... 62 | alter table RESOURCES enable all triggers; 63 | prompt Enabling triggers for ROLES... 64 | alter table ROLES enable all triggers; 65 | prompt Enabling triggers for ROLES_RESOURCES... 66 | alter table ROLES_RESOURCES enable all triggers; 67 | prompt Enabling triggers for USERS... 68 | alter table USERS enable all triggers; 69 | prompt Enabling triggers for USERS_ROLES... 70 | alter table USERS_ROLES enable all triggers; 71 | set feedback on 72 | set define on 73 | prompt Done. 74 | -------------------------------------------------------------------------------- /src/test/java/database/seq.sql: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------- 2 | -- Export file for user SA@ORCL -- 3 | -- Created by wangpengfei on 2015/10/10, 16:49:24 -- 4 | ---------------------------------------------------- 5 | 6 | set define off 7 | spool seq.log 8 | 9 | prompt 10 | prompt Creating sequence RESOURECES_SEQ 11 | prompt ================================ 12 | prompt 13 | create sequence SA.RESOURECES_SEQ 14 | minvalue 1 15 | maxvalue 9999999999999999999999999999 16 | start with 4 17 | increment by 1 18 | nocache; 19 | 20 | prompt 21 | prompt Creating sequence ROLES_SEQ 22 | prompt =========================== 23 | prompt 24 | create sequence SA.ROLES_SEQ 25 | minvalue 1 26 | maxvalue 9999999999999999999999999999 27 | start with 4 28 | increment by 1 29 | nocache; 30 | 31 | prompt 32 | prompt Creating sequence USERS_SEQ 33 | prompt =========================== 34 | prompt 35 | create sequence SA.USERS_SEQ 36 | minvalue 1 37 | maxvalue 9999999999999999999999999999 38 | start with 3 39 | increment by 1 40 | nocache; 41 | 42 | 43 | spool off 44 | -------------------------------------------------------------------------------- /src/test/java/database/tables.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengfit/p2p/12541f0928106d05284f7e3dbf71e4f102b28eb3/src/test/java/database/tables.sql -------------------------------------------------------------------------------- /src/test/java/database/triger.sql: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------- 2 | -- Export file for user SA@ORCL -- 3 | -- Created by wangpengfei on 2015/10/10, 16:49:41 -- 4 | ---------------------------------------------------- 5 | 6 | set define off 7 | spool triger.log 8 | 9 | prompt 10 | prompt Creating trigger RESOURCE_TRIGER 11 | prompt ================================ 12 | prompt 13 | CREATE OR REPLACE TRIGGER SA. 14 | resource_triger 15 | BEFORE INSERT ON RESOURCES 16 | FOR EACH ROW 17 | 18 | BEGIN 19 | SELECT resoureces_seq.nextval INTO :new.id FROM dual; 20 | END; 21 | / 22 | 23 | prompt 24 | prompt Creating trigger ROLES_TRIGER 25 | prompt ============================= 26 | prompt 27 | CREATE OR REPLACE TRIGGER SA. 28 | roles_triger 29 | BEFORE INSERT ON ROLES 30 | FOR EACH ROW 31 | 32 | BEGIN 33 | SELECT roles_seq.nextval INTO :new.id FROM dual; 34 | END; 35 | / 36 | 37 | prompt 38 | prompt Creating trigger USERS_TRIGER 39 | prompt ============================= 40 | prompt 41 | CREATE OR REPLACE TRIGGER SA. 42 | users_triger 43 | BEFORE INSERT ON USERS 44 | FOR EACH ROW 45 | 46 | BEGIN 47 | SELECT users_seq.nextval INTO :new.id FROM dual; 48 | END; 49 | / 50 | 51 | 52 | spool off 53 | --------------------------------------------------------------------------------