├── .gitignore ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── MyDSKeyStore.jks ├── README.md ├── blockchain_springboot ├── .gitignore ├── MyDSKeyStore.jks ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── cqupt │ │ │ └── bear │ │ │ └── blockchain │ │ │ ├── BlockchainApplication.java │ │ │ ├── aspect │ │ │ ├── entity │ │ │ │ └── RequestLog.java │ │ │ └── service │ │ │ │ └── LogAspect.java │ │ │ ├── common │ │ │ ├── config │ │ │ │ └── WebMvcConfig.java │ │ │ ├── constant │ │ │ │ └── ErrorCodes.java │ │ │ ├── exception │ │ │ │ ├── BaseException.java │ │ │ │ └── BusinessException.java │ │ │ └── utils │ │ │ │ ├── ExcelUtils.java │ │ │ │ ├── JsonUtils.java │ │ │ │ ├── JsoupUtils.java │ │ │ │ ├── NullSafeIterable.java │ │ │ │ ├── StringUtils.java │ │ │ │ └── TradeNoGenerator.java │ │ │ ├── evidence │ │ │ ├── dto │ │ │ │ ├── BlockchainTransaction.java │ │ │ │ └── EvidenceInfo.java │ │ │ ├── service │ │ │ │ ├── BlockService.java │ │ │ │ └── Web3jBlockServiceImpl.java │ │ │ └── web │ │ │ │ ├── AdminController.java │ │ │ │ ├── OfficerController.java │ │ │ │ ├── PublicController.java │ │ │ │ └── UserController.java │ │ │ ├── idp │ │ │ ├── config │ │ │ │ ├── HttpToHttpsConfig.java │ │ │ │ ├── WebSecurityConfig.java │ │ │ │ └── authentication │ │ │ │ │ ├── IdpAuthenticationFailureHandler.java │ │ │ │ │ ├── IdpAuthenticationSuccessHandler.java │ │ │ │ │ ├── Roles.java │ │ │ │ │ └── UserDetailsServiceImpl.java │ │ │ └── web │ │ │ │ ├── LoginController.java │ │ │ │ ├── StyleGuideController.java │ │ │ │ └── filter │ │ │ │ └── UrlFilter.java │ │ │ ├── redis │ │ │ └── RedisTemplateForSpringBoot.java │ │ │ └── test │ │ │ └── Wenku.java │ └── resources │ │ ├── application.yml │ │ ├── solidity │ │ └── Ballot.sol │ │ ├── static │ │ ├── assets │ │ │ ├── blockchain │ │ │ │ ├── blockchain tec.jpg │ │ │ │ ├── blockchain_chain.jpg │ │ │ │ ├── blockchain_connection.jpg │ │ │ │ ├── blockchain_world.jpg │ │ │ │ ├── blockchain_zhihu.jpg │ │ │ │ ├── chef_light.jpg │ │ │ │ ├── cover_light.jpg │ │ │ │ ├── cover_light_2.jpg │ │ │ │ ├── cover_light_3.jpg │ │ │ │ ├── cover_light_4.jpg │ │ │ │ ├── event_1_light.jpg │ │ │ │ ├── event_2_light.jpg │ │ │ │ ├── event_3_dark.jpg │ │ │ │ ├── event_3_light.jpg │ │ │ │ ├── food_10_light.jpg │ │ │ │ ├── food_11_light.jpg │ │ │ │ ├── food_12_light.jpg │ │ │ │ ├── food_1_light.jpg │ │ │ │ ├── food_2_light.jpg │ │ │ │ ├── food_3_light.jpg │ │ │ │ ├── food_4_light.jpg │ │ │ │ ├── food_5_light.jpg │ │ │ │ ├── food_6_light.jpg │ │ │ │ ├── food_7_light.jpg │ │ │ │ ├── food_8_light.jpg │ │ │ │ ├── food_9_light.jpg │ │ │ │ ├── makereservation_light.jpg │ │ │ │ ├── signature_light.png │ │ │ │ ├── testimonal_background_light.jpg │ │ │ │ ├── testimonial_1_light.jpg │ │ │ │ ├── testimonial_2_light.jpg │ │ │ │ ├── testimonial_3_light.jpg │ │ │ │ ├── venue_1_light.jpg │ │ │ │ ├── venue_2_light.jpg │ │ │ │ ├── venue_3_light.jpg │ │ │ │ ├── venue_4_light.jpg │ │ │ │ ├── 校名黑.png │ │ │ │ ├── 美丽重邮.jpg │ │ │ │ ├── 腾飞门.jpg │ │ │ │ ├── 重庆邮电大学.jpg │ │ │ │ ├── 重庆邮电大学标准校徽.png │ │ │ │ ├── 重邮新貌.jpg │ │ │ │ ├── 重邮泳池.jpg │ │ │ │ ├── 重邮老照片腾飞们.jpg │ │ │ │ └── 雪后二教.jpg │ │ │ └── styleguide │ │ │ │ ├── cover_1.jpg │ │ │ │ ├── cover_2.jpg │ │ │ │ ├── cover_3.jpg │ │ │ │ ├── cover_4.jpg │ │ │ │ ├── people_1.jpg │ │ │ │ ├── people_2.jpg │ │ │ │ ├── people_3.jpg │ │ │ │ ├── people_4.jpg │ │ │ │ ├── people_5.jpg │ │ │ │ └── people_6.jpg │ │ ├── css │ │ │ ├── aquamarine.css │ │ │ └── aquamarine.scss │ │ └── js │ │ │ ├── amap.js │ │ │ ├── animate-in.js │ │ │ ├── navbar-ontop.js │ │ │ └── smooth-scroll.js │ │ └── templates │ │ ├── admin │ │ └── adminIndex.html │ │ ├── error.html │ │ ├── index.html │ │ ├── login.html │ │ ├── officer │ │ └── officerIndex.html │ │ ├── register.html │ │ ├── styleguide.html │ │ └── user │ │ ├── query.html │ │ ├── queryResult.html │ │ ├── upload.html │ │ ├── uploadSuccess.html │ │ └── userIndex.html │ └── test │ └── java │ └── com │ └── cqupt │ └── bear │ └── blockchain │ └── BlockchainApplicationTests.java ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── cqupt │ │ └── bear │ │ └── blockchain │ │ ├── BlockchainApplication.java │ │ ├── aspect │ │ ├── entity │ │ │ └── RequestLog.java │ │ └── service │ │ │ └── LogAspect.java │ │ ├── common │ │ ├── config │ │ │ └── WebMvcConfig.java │ │ ├── constant │ │ │ └── ErrorCodes.java │ │ ├── exception │ │ │ ├── BaseException.java │ │ │ └── BusinessException.java │ │ └── utils │ │ │ ├── ExcelUtils.java │ │ │ ├── JsonUtils.java │ │ │ ├── JsoupUtils.java │ │ │ ├── NullSafeIterable.java │ │ │ ├── StringUtils.java │ │ │ └── TradeNoGenerator.java │ │ ├── evidence │ │ ├── dto │ │ │ ├── BlockchainTransaction.java │ │ │ └── EvidenceInfo.java │ │ ├── service │ │ │ ├── BlockService.java │ │ │ └── Web3jBlockServiceImpl.java │ │ └── web │ │ │ ├── AdminController.java │ │ │ ├── OfficerController.java │ │ │ ├── PublicController.java │ │ │ └── UserController.java │ │ ├── idp │ │ ├── config │ │ │ ├── HttpToHttpsConfig.java │ │ │ ├── WebSecurityConfig.java │ │ │ └── authentication │ │ │ │ ├── IdpAuthenticationFailureHandler.java │ │ │ │ ├── IdpAuthenticationSuccessHandler.java │ │ │ │ ├── Roles.java │ │ │ │ └── UserDetailsServiceImpl.java │ │ └── web │ │ │ ├── LoginController.java │ │ │ ├── StyleGuideController.java │ │ │ └── filter │ │ │ └── UrlFilter.java │ │ ├── redis │ │ └── RedisTemplateForSpringBoot.java │ │ └── test │ │ └── Wenku.java └── resources │ ├── application.yml │ ├── static │ ├── assets │ │ ├── blockchain │ │ │ ├── blockchain tec.jpg │ │ │ ├── blockchain_chain.jpg │ │ │ ├── blockchain_connection.jpg │ │ │ ├── blockchain_world.jpg │ │ │ ├── blockchain_zhihu.jpg │ │ │ ├── chef_light.jpg │ │ │ ├── cover_light.jpg │ │ │ ├── cover_light_2.jpg │ │ │ ├── cover_light_3.jpg │ │ │ ├── cover_light_4.jpg │ │ │ ├── event_1_light.jpg │ │ │ ├── event_2_light.jpg │ │ │ ├── event_3_dark.jpg │ │ │ ├── event_3_light.jpg │ │ │ ├── food_10_light.jpg │ │ │ ├── food_11_light.jpg │ │ │ ├── food_12_light.jpg │ │ │ ├── food_1_light.jpg │ │ │ ├── food_2_light.jpg │ │ │ ├── food_3_light.jpg │ │ │ ├── food_4_light.jpg │ │ │ ├── food_5_light.jpg │ │ │ ├── food_6_light.jpg │ │ │ ├── food_7_light.jpg │ │ │ ├── food_8_light.jpg │ │ │ ├── food_9_light.jpg │ │ │ ├── makereservation_light.jpg │ │ │ ├── signature_light.png │ │ │ ├── testimonal_background_light.jpg │ │ │ ├── testimonial_1_light.jpg │ │ │ ├── testimonial_2_light.jpg │ │ │ ├── testimonial_3_light.jpg │ │ │ ├── venue_1_light.jpg │ │ │ ├── venue_2_light.jpg │ │ │ ├── venue_3_light.jpg │ │ │ ├── venue_4_light.jpg │ │ │ ├── 校名黑.png │ │ │ ├── 美丽重邮.jpg │ │ │ ├── 腾飞门.jpg │ │ │ ├── 重庆邮电大学.jpg │ │ │ ├── 重庆邮电大学标准校徽.png │ │ │ ├── 重邮新貌.jpg │ │ │ ├── 重邮泳池.jpg │ │ │ ├── 重邮老照片腾飞们.jpg │ │ │ └── 雪后二教.jpg │ │ └── styleguide │ │ │ ├── cover_1.jpg │ │ │ ├── cover_2.jpg │ │ │ ├── cover_3.jpg │ │ │ ├── cover_4.jpg │ │ │ ├── people_1.jpg │ │ │ ├── people_2.jpg │ │ │ ├── people_3.jpg │ │ │ ├── people_4.jpg │ │ │ ├── people_5.jpg │ │ │ └── people_6.jpg │ ├── css │ │ ├── aquamarine.css │ │ └── aquamarine.scss │ └── js │ │ ├── amap.js │ │ ├── animate-in.js │ │ ├── navbar-ontop.js │ │ └── smooth-scroll.js │ └── templates │ ├── admin │ └── adminIndex.html │ ├── error.html │ ├── index.html │ ├── login.html │ ├── officer │ └── officerIndex.html │ ├── register.html │ ├── styleguide.html │ └── user │ ├── query.html │ ├── queryResult.html │ ├── upload.html │ ├── uploadSuccess.html │ └── userIndex.html └── test └── java └── com └── cqupt └── bear └── blockchain └── BlockchainApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | 27 | # Compiled class file 28 | *.class 29 | 30 | # Log file 31 | /log/ 32 | *.log 33 | 34 | # BlueJ files 35 | *.ctxt 36 | 37 | # Mobile Tools for Java (J2ME) 38 | .mtj.tmp/ 39 | 40 | # Package Files # 41 | *.jar 42 | *.war 43 | *.ear 44 | *.zip 45 | *.tar.gz 46 | *.rar 47 | 48 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 49 | hs_err_pid* 50 | /target/ 51 | 52 | # java key store 53 | # *.jks 54 | 55 | # evidences 56 | /evidences/ -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /MyDSKeyStore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/MyDSKeyStore.jks -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # block 2 | 区块链电子证据保全项目(个人开发中,未完待续) 3 | 参考网址: https://ybear-web.com/index 4 | 个人博客: https://blog.csdn.net/qq_24407053 5 | 6 | 7 | 页面截图及效果参考: 8 | 9 | https://blog.csdn.net/qq_24407053/article/details/85618314 10 | 11 | 开发环境: 12 | 1. JDK1.8 13 | 2. Maven 14 | 3. Spring Boot + SpringMVC + Mybatis 15 | 4. Spring Security + Spring Social + Spring OAuth 16 | 5. Bubi SDK 17 | 6. web3j 18 | 7. EVM 19 | 8. docker 20 | 21 | --- 22 | 23 | 目标: 24 | 1. 提供基于Spring Security 的安全网站 25 | 2. 提供常规登录模式以及第三方登录 26 | 3. 基于布比区块链完成数据模块的搭建,保证证据信息上链 27 | 4. 基于web3j实现对以太坊的链上代码调用 28 | 5. 基于配置选择布比或者以太坊进行数据上链服务 29 | 5. 对于热点数据采用Redis进行保存 30 | 6. 尽力完成基于证据链的系统开发 31 | 32 | 运行方法: 33 | 1. 无需更改源码,以maven工程导入 34 | 2. 安装docker,并在命令行中运行 35 | ``` 36 | docker run -d --name ethereum -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rpcaddr "0.0.0.0" --rpcapi="db,eth,net,web3,personal" --rpccorsdomain "*" --dev 37 | ``` 38 | 3. 运行springboot项目 39 | 4. 账户user 密码:123456(目前没有集成数据库,是写死的,不能注册) 40 | 5. .../user进入功能页面,提供存证和查证功能 41 | -------------------------------------------------------------------------------- /blockchain_springboot/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | 27 | # Compiled class file 28 | *.class 29 | 30 | # Log file 31 | /log/ 32 | *.log 33 | 34 | # BlueJ files 35 | *.ctxt 36 | 37 | # Mobile Tools for Java (J2ME) 38 | .mtj.tmp/ 39 | 40 | # Package Files # 41 | *.jar 42 | *.war 43 | *.ear 44 | *.zip 45 | *.tar.gz 46 | *.rar 47 | 48 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 49 | hs_err_pid* 50 | /target/ 51 | 52 | # java key store 53 | # *.jks 54 | 55 | # evidences 56 | /evidences/ -------------------------------------------------------------------------------- /blockchain_springboot/MyDSKeyStore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/MyDSKeyStore.jks -------------------------------------------------------------------------------- /blockchain_springboot/README.md: -------------------------------------------------------------------------------- 1 | # block 2 | 区块链电子证据保全项目(个人开发中,未完待续) 3 | 参考网址: https://ybear-web.com/index 4 | 个人博客: https://blog.csdn.net/qq_24407053 5 | 6 | 7 | 页面截图及效果参考: 8 | 9 | https://blog.csdn.net/qq_24407053/article/details/85618314 10 | 11 | 开发环境: 12 | 1. JDK1.8 13 | 2. Maven 14 | 3. Spring Boot + SpringMVC + Mybatis 15 | 4. Spring Security + Spring Social + Spring OAuth 16 | 5. Bubi SDK 17 | 6. web3j 18 | 7. EVM 19 | 8. docker 20 | 21 | --- 22 | 23 | 目标: 24 | 1. 提供基于Spring Security 的安全网站 25 | 2. 提供常规登录模式以及第三方登录 26 | 3. 基于布比区块链完成数据模块的搭建,保证证据信息上链 27 | 4. 基于web3j实现对以太坊的链上代码调用 28 | 5. 基于配置选择布比或者以太坊进行数据上链服务 29 | 5. 对于热点数据采用Redis进行保存 30 | 6. 尽力完成基于证据链的系统开发 31 | 32 | 运行方法: 33 | 1. 无需更改源码,以maven工程导入 34 | 2. 安装docker,并在命令行中运行 35 | ``` 36 | docker run -d --name ethereum -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rpcaddr "0.0.0.0" --rpcapi="db,eth,net,web3,personal" --rpccorsdomain "*" --dev 37 | ``` 38 | 3. 运行springboot项目 39 | 4. 账户user 密码:123456(目前没有集成数据库,是写死的,不能注册) 40 | 5. .../user进入功能页面,提供存证和查证功能 41 | -------------------------------------------------------------------------------- /blockchain_springboot/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/BlockchainApplication.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain; 2 | 3 | import org.apache.tomcat.util.buf.HexUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.web3j.protocol.Web3j; 10 | import org.web3j.protocol.core.DefaultBlockParameterName; 11 | import org.web3j.protocol.core.methods.request.Transaction; 12 | import org.web3j.protocol.core.methods.response.EthCoinbase; 13 | import org.web3j.protocol.core.methods.response.EthGetTransactionCount; 14 | 15 | import javax.annotation.PostConstruct; 16 | import java.io.IOException; 17 | import java.math.BigInteger; 18 | 19 | @SpringBootApplication 20 | public class BlockchainApplication { 21 | private final Logger LOGGER = LoggerFactory.getLogger(getClass()); 22 | 23 | private final Web3j web3j; 24 | 25 | public static void main(String[] args) { 26 | SpringApplication.run(BlockchainApplication.class, args); 27 | } 28 | 29 | @Autowired 30 | public BlockchainApplication(Web3j web3j) { 31 | super(); 32 | this.web3j = web3j; 33 | } 34 | 35 | @PostConstruct 36 | public void listen() { 37 | web3j.transactionObservable().subscribe(tx -> { 38 | LOGGER.info("New tx: id={}, block={}, from={}, to={}, value={},data={}", tx.getHash(), tx.getBlockHash(), 39 | tx.getFrom(), tx.getTo(), tx.getValue().intValue(), 40 | new String(HexUtils.fromHexString(tx.getInput().substring(2)))); 41 | try { 42 | EthCoinbase coinbase = web3j.ethCoinbase().send(); 43 | EthGetTransactionCount transactionCount = web3j 44 | .ethGetTransactionCount(tx.getFrom(), DefaultBlockParameterName.LATEST).send(); 45 | LOGGER.info("Tx count: {}", transactionCount.getTransactionCount().intValue()); 46 | if (transactionCount.getTransactionCount().intValue() % 10 == 0) { 47 | 48 | EthGetTransactionCount tc = web3j 49 | .ethGetTransactionCount(coinbase.getAddress(), DefaultBlockParameterName.LATEST).send(); 50 | Transaction transaction = Transaction.createEtherTransaction(coinbase.getAddress(), 51 | tc.getTransactionCount(), tx.getValue(), BigInteger.valueOf(21_000), tx.getFrom(), 52 | tx.getValue()); 53 | web3j.ethSendTransaction(transaction).send(); 54 | } 55 | } catch (IOException e) { 56 | LOGGER.error("Error getting transactions", e); 57 | } 58 | }); 59 | LOGGER.info("Subscribed"); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/aspect/entity/RequestLog.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.aspect.entity; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * @author Y.bear 7 | * @version 创建时间:2018年9月1日 下午2:16:54 类说明 8 | */ 9 | public class RequestLog { 10 | private String url; 11 | private String ip; 12 | private String classMethod; 13 | private Object[] args; 14 | 15 | public RequestLog(String url, String ip, String classMethod, Object[] args) { 16 | super(); 17 | this.url = url; 18 | this.ip = ip; 19 | this.classMethod = classMethod; 20 | this.args = args; 21 | } 22 | 23 | public String getUrl() { 24 | return url; 25 | } 26 | 27 | public void setUrl(String url) { 28 | this.url = url; 29 | } 30 | 31 | public String getIp() { 32 | return ip; 33 | } 34 | 35 | public void setIp(String ip) { 36 | this.ip = ip; 37 | } 38 | 39 | public String getClassMethod() { 40 | return classMethod; 41 | } 42 | 43 | public void setClassMethod(String classMethod) { 44 | this.classMethod = classMethod; 45 | } 46 | 47 | public Object[] getArgs() { 48 | return args; 49 | } 50 | 51 | public void setArgs(Object[] args) { 52 | this.args = args; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "RequestLog [url=" + url + ", ip=" + ip + ", classMethod=" + classMethod + ", args=" 58 | + Arrays.toString(args) + "]"; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/aspect/service/LogAspect.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.aspect.service; 2 | 3 | import com.cqupt.bear.blockchain.aspect.entity.RequestLog; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.annotation.Aspect; 6 | import org.aspectj.lang.annotation.Before; 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 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年9月1日 下午2:07:56 类说明 16 | */ 17 | @Aspect 18 | @Component 19 | public class LogAspect { 20 | private final Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | // @Pointcut("execution(* com.cqupt.bear.blockchain.*.web.*.*(..))") 23 | // public void log() { 24 | // 25 | // } 26 | 27 | @Before("execution(* com.cqupt.bear.blockchain.*.web.*.*(..))") 28 | public void doBefore(JoinPoint joinPoint) { 29 | String classMethod = joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName(); 30 | Object[] args = joinPoint.getArgs(); 31 | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder 32 | .getRequestAttributes(); 33 | String url = requestAttributes.getRequest().getRequestURL().toString(); 34 | String ip = requestAttributes.getRequest().getRemoteAddr(); 35 | RequestLog requestLog = new RequestLog(url, ip, classMethod, args); 36 | logger.info("Request: {} ", requestLog); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年11月27日 下午3:52:02 类说明 10 | * addViewControllers可以方便的实现一个请求直接映射成视图,而无需书写controller 11 | * registry.addViewController("请求路径").setViewName("请求页面文件路径") 12 | */ 13 | 14 | @Configuration 15 | public class WebMvcConfig implements WebMvcConfigurer { 16 | @Override 17 | public void addViewControllers(ViewControllerRegistry registry) { 18 | registry.addViewController("/error").setViewName("error"); 19 | registry.addViewController("/success").setViewName("success"); 20 | registry.addViewController("/index").setViewName("index"); 21 | registry.addViewController("/register").setViewName("register"); 22 | registry.addViewController("/admin").setViewName("admin/adminIndex"); 23 | registry.addViewController("/officer").setViewName("officer/officerIndex"); 24 | registry.addViewController("/user").setViewName("user/userIndex"); 25 | registry.addViewController("/user/upload").setViewName("user/upload"); 26 | registry.addViewController("/user/queryPage").setViewName("user/query"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/constant/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.constant; 2 | 3 | public class ErrorCodes { 4 | public static final String BUSINESS_EXCEPTION = "BUSINESS_EXCEPTION"; 5 | } 6 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/exception/BaseException.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.exception; 2 | 3 | public class BaseException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 570191527602767524L; 6 | 7 | private String errorCode; 8 | 9 | private Object[] args; 10 | 11 | public BaseException(String errorCode) { 12 | this.errorCode = errorCode; 13 | } 14 | 15 | public BaseException(String errorCode, Object... args) { 16 | this.errorCode = errorCode; 17 | this.args = args; 18 | } 19 | 20 | public BaseException(String errorCode, Throwable cause) { 21 | super(cause); 22 | this.errorCode = errorCode; 23 | } 24 | 25 | public BaseException(String errorCode, Throwable cause, Object... args) { 26 | super(cause); 27 | this.errorCode = errorCode; 28 | this.args = args; 29 | } 30 | 31 | public String getErrorCode() { 32 | return errorCode; 33 | } 34 | 35 | protected Object[] getArgs() { 36 | return args; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.exception; 2 | 3 | public class BusinessException extends BaseException { 4 | /** 5 | * 6 | */ 7 | private static final long serialVersionUID = -6052969006553501912L; 8 | 9 | public BusinessException(String errorCode) { 10 | super(errorCode); 11 | } 12 | 13 | public BusinessException(String errorCode, Object... args) { 14 | super(errorCode, args); 15 | } 16 | 17 | public BusinessException(String errorCode, Throwable cause) { 18 | super(errorCode, cause); 19 | } 20 | 21 | public BusinessException(String errorCode, Throwable cause, Object... args) { 22 | super(errorCode, cause, args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/ExcelUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import org.apache.poi.ss.usermodel.Cell; 4 | import org.apache.poi.xssf.usermodel.XSSFRow; 5 | import org.apache.poi.xssf.usermodel.XSSFSheet; 6 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; 7 | 8 | import java.io.File; 9 | import java.io.FileInputStream; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | import java.util.Set; 15 | import java.util.TreeMap; 16 | 17 | public class ExcelUtils { 18 | public static void readFromExcel(String fileName) throws IOException { 19 | File file = new File(fileName + ".xlsx"); 20 | FileInputStream fIP = new FileInputStream(file); 21 | // Get the workbook instance for XLSX file 22 | XSSFWorkbook workbook = new XSSFWorkbook(fIP); 23 | if (file.isFile() && file.exists()) { 24 | System.out.println("openworkbook.xlsx file open successfully."); 25 | } else { 26 | System.out.println("Error to open openworkbook.xlsx file."); 27 | } 28 | workbook.close(); 29 | 30 | } 31 | 32 | public static void toExcel(Map map, String fileName, String sheetName) throws IOException { 33 | XSSFWorkbook workbook = new XSSFWorkbook(); 34 | XSSFSheet spreadsheet = workbook.createSheet(sheetName); 35 | Set keyid = map.keySet(); 36 | int rowid = 0; 37 | XSSFRow row; 38 | for (String key : keyid) { 39 | row = spreadsheet.createRow(rowid++); 40 | Object[] objectArr = map.get(key); 41 | int cellid = 0; 42 | for (Object obj : objectArr) { 43 | Cell cell = row.createCell(cellid++); 44 | cell.setCellValue((String) obj); 45 | } 46 | } 47 | // Write the workbook in file system 48 | FileOutputStream out = new FileOutputStream(new File(fileName + ".xlsx")); 49 | workbook.write(out); 50 | out.close(); 51 | workbook.close(); 52 | System.out.println(fileName + ".xlsx written successfully"); 53 | } 54 | 55 | public static void createNewExcel(String fileName) throws IOException { 56 | XSSFWorkbook workbook = new XSSFWorkbook(); 57 | // Create file system using specific name 58 | FileOutputStream out = new FileOutputStream(new File(fileName + ".xlsx")); 59 | // write operation workbook using file out object 60 | workbook.write(out); 61 | out.close(); 62 | workbook.close(); 63 | System.out.println("create " + fileName + " successfully"); 64 | } 65 | 66 | public static void toExcelExample() throws IOException { 67 | // Create blank workbook 68 | XSSFWorkbook workbook = new XSSFWorkbook(); 69 | // Create a blank sheet 70 | XSSFSheet spreadsheet = workbook.createSheet(" Employee Info "); 71 | // Create row object 72 | XSSFRow row; 73 | // This data needs to be written (Object[]) 74 | Map empinfo = new TreeMap(); 75 | empinfo.put("1", new Object[]{"EMP ID", "EMP NAME", "DESIGNATION"}); 76 | empinfo.put("2", new Object[]{"tp01", "Gopal", "Technical Manager"}); 77 | empinfo.put("3", new Object[]{"tp02", "Manisha", "Proof Reader"}); 78 | empinfo.put("4", new Object[]{"tp03", "Masthan", "Technical Writer"}); 79 | empinfo.put("5", new Object[]{"tp04", "Satish", "Technical Writer"}); 80 | empinfo.put("6", new Object[]{"tp05", "Krishna", "Technical Writer"}); 81 | // Iterate over data and write to sheet 82 | Set keyid = empinfo.keySet(); 83 | int rowid = 0; 84 | for (String key : keyid) { 85 | row = spreadsheet.createRow(rowid++); 86 | Object[] objectArr = empinfo.get(key); 87 | int cellid = 0; 88 | for (Object obj : objectArr) { 89 | Cell cell = row.createCell(cellid++); 90 | cell.setCellValue((String) obj); 91 | } 92 | } 93 | // Write the workbook in file system 94 | FileOutputStream out = new FileOutputStream(new File("myTest.xlsx")); 95 | workbook.write(out); 96 | out.close(); 97 | workbook.close(); 98 | System.out.println("Writesheet.xlsx written successfully"); 99 | } 100 | 101 | public static void main(String[] args) { 102 | try { 103 | String fileName = "test"; 104 | String sheetName = "empInfo"; 105 | Map map = new HashMap<>(); 106 | map.put("1", new Object[]{"EMP ID", "EMP NAME", "DESIGNATION"}); 107 | map.put("2", new Object[]{"tp01", "Gopal", "Technical Manager"}); 108 | map.put("3", new Object[]{"tp02", "Manisha", "Proof Reader", "", "完美", " ", "2012.12.12"}); 109 | map.put("4", new Object[]{"tp03", "Masthan", "Technical Writer", "专利权转让"}); 110 | map.put("5", new Object[]{"tp04", "Satish", "Technical Writer"}); 111 | map.put("6", new Object[]{"tp05", "Krishna", "Technical Writer", "test"}); 112 | createNewExcel(fileName); 113 | toExcel(map, fileName, sheetName); 114 | } catch (IOException e) { 115 | System.out.println("异常"); 116 | e.printStackTrace(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/JsonUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.google.gson.*; 6 | import com.google.gson.reflect.TypeToken; 7 | 8 | import java.io.IOException; 9 | import java.util.*; 10 | 11 | public class JsonUtils { 12 | 13 | public static ObjectMapper OBJECT_MAPPER = new ObjectMapper(); 14 | 15 | public static T fromJson(String jsonString, Class valueType) throws IOException { 16 | return OBJECT_MAPPER.readValue(jsonString, valueType); 17 | } 18 | 19 | public static String toJson(Object object) throws JsonProcessingException { 20 | return OBJECT_MAPPER.writeValueAsString(object); 21 | } 22 | 23 | /** 24 | * 将Map转成json 25 | * 26 | * @param map 27 | * @return 28 | */ 29 | public static String mapToJson(Map map) { 30 | Gson gson = new Gson(); 31 | return gson.toJson(map, Map.class); 32 | } 33 | 34 | /** 35 | * 将List转成json 36 | * 37 | * @param list 38 | * @return 39 | */ 40 | public static String collectionToJson(Collection authorities) { 41 | Gson gson = new Gson(); 42 | return gson.toJson(authorities, Collection.class); 43 | } 44 | 45 | /** 46 | * 将Json串转化为list 47 | * 48 | * @param 49 | * @param json 50 | * @return 51 | */ 52 | public static List toList(String json, Class clazz) { 53 | Gson gson = new Gson(); 54 | return gson.fromJson(json, new TypeToken>() { 55 | }.getType()); 56 | 57 | } 58 | 59 | /** 60 | * 依据json字符串返回Map对象 61 | * 62 | * @param json 63 | * @return 64 | */ 65 | public static Map toMap(String json) { 66 | return JsonUtils.toMap(JsonUtils.parseJson(json)); 67 | } 68 | 69 | /** 70 | * 获取JsonObject 71 | * 72 | * @param json 73 | * @return 74 | */ 75 | public static JsonObject parseJson(String json) { 76 | JsonParser parser = new JsonParser(); 77 | JsonObject jsonObj = parser.parse(json).getAsJsonObject(); 78 | return jsonObj; 79 | } 80 | 81 | /** 82 | * 将JSONObjec对象转换成Map-List集合 83 | * 84 | * @param json 85 | * @return 86 | */ 87 | public static Map toMap(JsonObject json) { 88 | Map map = new HashMap(); 89 | Set> entrySet = json.entrySet(); 90 | for (Iterator> iter = entrySet.iterator(); iter.hasNext(); ) { 91 | Map.Entry entry = iter.next(); 92 | String key = entry.getKey(); 93 | Object value = entry.getValue(); 94 | if (value instanceof JsonArray) 95 | map.put((String) key, toList((JsonArray) value)); 96 | else if (value instanceof JsonObject) 97 | map.put((String) key, toMap((JsonObject) value)); 98 | else 99 | map.put((String) key, value); 100 | } 101 | return map; 102 | } 103 | 104 | /** 105 | * 将JSONArray对象转换成List集合 106 | * 107 | * @param json 108 | * @return 109 | */ 110 | public static List toList(JsonArray json) { 111 | List list = new ArrayList(); 112 | for (int i = 0; i < json.size(); i++) { 113 | Object value = json.get(i); 114 | if (value instanceof JsonArray) { 115 | list.add(toList((JsonArray) value)); 116 | } else if (value instanceof JsonObject) { 117 | list.add(toMap((JsonObject) value)); 118 | } else { 119 | list.add(value); 120 | } 121 | } 122 | return list; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/JsoupUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.nodes.Element; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年10月20日 下午12:22:06 类说明 10 | */ 11 | public class JsoupUtils { 12 | /** 13 | * html->dom 14 | * 15 | * @param htmlString 16 | * @return 17 | */ 18 | public static Document getDomFromString(String htmlString) { 19 | Document document = Jsoup.parse(htmlString); 20 | return document; 21 | } 22 | 23 | /** 24 | * 根据id获取value(input) 25 | * 26 | * @param document 27 | * @param id 28 | * @return 29 | */ 30 | public static String getElementById(Document document, String id) { 31 | Element element = document.getElementById(id); 32 | return element.attr("value"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/NullSafeIterable.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import java.util.Arrays; 4 | import java.util.Iterator; 5 | import java.util.NoSuchElementException; 6 | 7 | public class NullSafeIterable implements Iterable { 8 | private Iterable iterable; 9 | 10 | private T[] array; 11 | 12 | private boolean isArray; 13 | 14 | public NullSafeIterable(Iterable iterable) { 15 | this.iterable = iterable; 16 | } 17 | 18 | public NullSafeIterable(T[] array) { 19 | this.array = array; 20 | this.isArray = true; 21 | } 22 | 23 | public Iterator iterator() { 24 | if (isArray) { 25 | if (array == null) { 26 | return new NullSafeIterator(); 27 | } else { 28 | return Arrays.asList(array).iterator(); 29 | } 30 | } else { 31 | if (iterable == null) { 32 | return new NullSafeIterator(); 33 | } else { 34 | return iterable.iterator(); 35 | } 36 | } 37 | 38 | } 39 | 40 | class NullSafeIterator implements Iterator { 41 | 42 | public boolean hasNext() { 43 | return false; 44 | } 45 | 46 | public T next() { 47 | throw new NoSuchElementException(); 48 | } 49 | 50 | public void remove() { 51 | throw new UnsupportedOperationException(); 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年10月9日 下午2:36:45 类说明 6 | */ 7 | public class StringUtils { 8 | public static String removeFirstAndLast(String s) { 9 | s = s.substring(1, s.length()); 10 | s = s.substring(0, s.length() - 1); 11 | return s; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/common/utils/TradeNoGenerator.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | /** 4 | * @date 2018年1月19日下午5:26:24 5 | * @description 6 | */ 7 | public class TradeNoGenerator { 8 | public static String generatTradeNo() { 9 | return String.valueOf((int) (Math.random() * 1000000000)); 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/dto/BlockchainTransaction.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.dto; 2 | 3 | public class BlockchainTransaction { 4 | 5 | private String id; 6 | private int fromId; 7 | private int toId; 8 | private long value; 9 | private boolean accepted; 10 | private String data; 11 | 12 | public BlockchainTransaction() { 13 | 14 | } 15 | 16 | public BlockchainTransaction(int fromId, int toId, long value) { 17 | this.fromId = fromId; 18 | this.toId = toId; 19 | this.value = value; 20 | } 21 | 22 | public BlockchainTransaction(String id, int fromId, int toId, long value, boolean accepted, String data) { 23 | super(); 24 | this.id = id; 25 | this.fromId = fromId; 26 | this.toId = toId; 27 | this.value = value; 28 | this.accepted = accepted; 29 | this.data = data; 30 | } 31 | 32 | public String getData() { 33 | return data; 34 | } 35 | 36 | public void setData(String data) { 37 | this.data = data; 38 | } 39 | 40 | public String getId() { 41 | return id; 42 | } 43 | 44 | public void setId(String id) { 45 | this.id = id; 46 | } 47 | 48 | public int getFromId() { 49 | return fromId; 50 | } 51 | 52 | public void setFromId(int fromId) { 53 | this.fromId = fromId; 54 | } 55 | 56 | public int getToId() { 57 | return toId; 58 | } 59 | 60 | public void setToId(int toId) { 61 | this.toId = toId; 62 | } 63 | 64 | public long getValue() { 65 | return value; 66 | } 67 | 68 | public void setValue(long value) { 69 | this.value = value; 70 | } 71 | 72 | public boolean isAccepted() { 73 | return accepted; 74 | } 75 | 76 | public void setAccepted(boolean accepted) { 77 | this.accepted = accepted; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/dto/EvidenceInfo.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.dto; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年12月20日 上午9:51:55 类说明 6 | */ 7 | public class EvidenceInfo { 8 | private String MD5; 9 | private String blockId; 10 | private String transactionId; 11 | private String height; 12 | private BlockchainTransaction transaction; 13 | 14 | public EvidenceInfo(String MD5, String blockId, String transactionId, String height) { 15 | super(); 16 | this.MD5 = MD5; 17 | this.blockId = blockId; 18 | this.transactionId = transactionId; 19 | this.height = height; 20 | } 21 | 22 | public EvidenceInfo(String mD5, String blockId, String transactionId, String height, 23 | BlockchainTransaction transaction) { 24 | super(); 25 | MD5 = mD5; 26 | this.blockId = blockId; 27 | this.transactionId = transactionId; 28 | this.height = height; 29 | this.transaction = transaction; 30 | } 31 | 32 | public String getMD5() { 33 | return MD5; 34 | } 35 | 36 | public BlockchainTransaction getTransaction() { 37 | return transaction; 38 | } 39 | 40 | public void setTransaction(BlockchainTransaction transaction) { 41 | this.transaction = transaction; 42 | } 43 | 44 | public String getBlockId() { 45 | return blockId; 46 | } 47 | 48 | public String getTransactionId() { 49 | return transactionId; 50 | } 51 | 52 | public String getHeight() { 53 | return height; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "EvidenceInfo [MD5=" + MD5 + ", blockId=" + blockId + ", transactionId=" + transactionId + ", height=" 59 | + height + "]"; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/service/BlockService.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.service; 2 | 3 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 4 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年12月17日 上午9:48:54 类说明 面向接口编程,完成基于以太坊和布比区块链的智能合约调用 9 | */ 10 | public interface BlockService { 11 | void depoly(); 12 | 13 | BlockchainTransaction upload(BlockchainTransaction transaction) throws Exception; 14 | 15 | EvidenceInfo query(String blockHash) throws Exception; 16 | } 17 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/service/Web3jBlockServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.service; 2 | 3 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 4 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 5 | import org.apache.tomcat.util.buf.HexUtils; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | import org.web3j.protocol.Web3j; 11 | import org.web3j.protocol.core.methods.request.Transaction; 12 | import org.web3j.protocol.core.methods.response.EthAccounts; 13 | import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt; 14 | import org.web3j.protocol.core.methods.response.EthSendTransaction; 15 | import org.web3j.protocol.core.methods.response.EthTransaction; 16 | 17 | import java.io.IOException; 18 | 19 | /** 20 | * @author Y.bear 21 | * @version 创建时间:2018年12月30日 上午11:48:24 类说明 22 | */ 23 | @Service 24 | public class Web3jBlockServiceImpl implements BlockService { 25 | private final Logger LOGGER = LoggerFactory.getLogger(getClass()); 26 | @Autowired 27 | private Web3j web3j; 28 | 29 | @Override 30 | public void depoly() { 31 | 32 | } 33 | 34 | @Override 35 | public BlockchainTransaction upload(BlockchainTransaction trx) throws IOException { 36 | EthAccounts accounts = web3j.ethAccounts().send(); 37 | Transaction transaction = Transaction.createEthCallTransaction(accounts.getAccounts().get(trx.getFromId()), 38 | accounts.getAccounts().get(trx.getToId()), HexUtils.toHexString(trx.getData().getBytes("UTF-8"))); 39 | EthSendTransaction response = web3j.ethSendTransaction(transaction).send(); 40 | if (response.getError() != null) { 41 | trx.setAccepted(false); 42 | LOGGER.info("Tx rejected: {}", response.getError().getMessage()); 43 | return trx; 44 | } 45 | trx.setAccepted(true); 46 | String txHash = response.getTransactionHash(); 47 | LOGGER.info("Tx hash: {}", txHash); 48 | trx.setId(txHash); 49 | EthGetTransactionReceipt receipt = web3j.ethGetTransactionReceipt(txHash).send(); 50 | receipt.getTransactionReceipt().ifPresent(transactionReceipt -> LOGGER.info("Tx receipt: {}", 51 | transactionReceipt.getCumulativeGasUsed().intValue())); 52 | return trx; 53 | } 54 | 55 | @Override 56 | public EvidenceInfo query(String txHash) throws Exception { 57 | EthTransaction transaction = web3j.ethGetTransactionByHash(txHash).send(); 58 | String data = new String(HexUtils.fromHexString(transaction.getResult().getInput().substring(2))); 59 | String blockHash = transaction.getResult().getBlockHash(); 60 | String height = transaction.getResult().getBlockNumber().toString(); 61 | LOGGER.info("txHash:" + txHash + "----" + "evidenceInput:" + data); 62 | BlockchainTransaction blockchainTransaction = new BlockchainTransaction(); 63 | blockchainTransaction.setData(data); 64 | EvidenceInfo evidenceInfo = new EvidenceInfo(data, blockHash, txHash, height); 65 | evidenceInfo.setTransaction(blockchainTransaction); 66 | return evidenceInfo; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/web/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月30日 下午7:22:08 9 | * 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/admin") 13 | public class AdminController { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/web/OfficerController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月30日 下午7:25:09 9 | * 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/officer") 13 | public class OfficerController { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/web/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年11月30日 下午7:22:27 6 | * 类说明 7 | */ 8 | public class PublicController { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/evidence/web/UserController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import com.cqupt.bear.blockchain.common.utils.JsonUtils; 4 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 5 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 6 | import com.cqupt.bear.blockchain.evidence.service.BlockService; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import org.apache.commons.codec.digest.DigestUtils; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.beans.factory.annotation.Qualifier; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestBody; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.multipart.MultipartFile; 19 | import org.springframework.web.servlet.ModelAndView; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * @author Y.bear 25 | * @version 创建时间:2018年11月30日 下午7:21:57 类说明 26 | */ 27 | @Controller 28 | @RequestMapping("/user") 29 | public class UserController { 30 | private Logger logger = LoggerFactory.getLogger(getClass()); 31 | @Autowired 32 | @Qualifier("web3jBlockServiceImpl") 33 | private BlockService service; 34 | 35 | @PostMapping("/file") 36 | public ModelAndView upload(MultipartFile evidence, ModelAndView modelAndView, String identityCard, String telephone, 37 | String email) throws IllegalStateException, IOException { 38 | String originalFilename = evidence.getOriginalFilename(); 39 | String md5 = DigestUtils.md5Hex(evidence.getBytes()); 40 | // String folder=System.getProperty("user.dir")+"\\evidences"; 41 | // File localFile = new File(folder, originalFilename); 42 | // evidence.transferTo(localFile); 43 | BlockchainTransaction transaction = new BlockchainTransaction(); 44 | transaction.setData(md5); 45 | transaction.setFromId(0); 46 | transaction.setToId(0); 47 | try { 48 | transaction = executeData(transaction); 49 | } catch (Exception e) { 50 | // TODO Auto-generated catch block 51 | e.printStackTrace(); 52 | } 53 | logger.info(transaction.getId()); 54 | EvidenceInfo evidenceInfo = new EvidenceInfo(md5, "0001", transaction.getId().toString(), "0005", transaction); 55 | logger.info("文件:\"" + originalFilename + "\"成功写入," + "相关信息为:" + evidenceInfo.toString()); 56 | String json = JsonUtils.toJson(evidenceInfo); 57 | logger.info(json); 58 | modelAndView.addAllObjects(JsonUtils.toMap(json)); 59 | modelAndView.setViewName("user/uploadSuccess"); 60 | return modelAndView; 61 | } 62 | 63 | public BlockchainTransaction executeData(@RequestBody BlockchainTransaction transaction) throws Exception { 64 | return service.upload(transaction); 65 | } 66 | 67 | @GetMapping("/query") 68 | public ModelAndView queryBlock(String txHash, ModelAndView modelAndView) throws JsonProcessingException { 69 | EvidenceInfo info = null; 70 | if (txHash.startsWith("\"")) { 71 | txHash = txHash.substring(1, txHash.length() - 1); 72 | } 73 | logger.info("查询txHash:" + txHash); 74 | try { 75 | info = service.query(txHash); 76 | } catch (Exception e) { 77 | // TODO Auto-generated catch block 78 | e.printStackTrace(); 79 | } 80 | if (info != null) { 81 | String evidenceInfo = JsonUtils.toJson(info); 82 | modelAndView.addAllObjects(JsonUtils.toMap(evidenceInfo)); 83 | modelAndView.setViewName("user/queryResult"); 84 | } 85 | return modelAndView; 86 | } 87 | 88 | @PostMapping("/query") 89 | public ModelAndView query(String txHash, ModelAndView modelAndView) throws JsonProcessingException { 90 | ModelAndView result = queryBlock(txHash, modelAndView); 91 | return result; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/HttpToHttpsConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config; 2 | 3 | import org.apache.catalina.Context; 4 | import org.apache.catalina.connector.Connector; 5 | import org.apache.tomcat.util.descriptor.web.SecurityCollection; 6 | import org.apache.tomcat.util.descriptor.web.SecurityConstraint; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * @author Y.bear 14 | * @version 创建时间:2018年11月26日 下午3:01:54 类说明 15 | */ 16 | @Configuration 17 | public class HttpToHttpsConfig { 18 | @Value("${http.port}") 19 | int httpPort; 20 | @Value("${server.port}") 21 | int httpsPort; 22 | 23 | /** 24 | * it's for set http url auto change to https 25 | */ 26 | @Bean 27 | public TomcatServletWebServerFactory servletContainer() { 28 | TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { 29 | @Override 30 | protected void postProcessContext(Context context) { 31 | SecurityConstraint constraint = new SecurityConstraint(); 32 | constraint.setUserConstraint("CONFIDENTIAL"); 33 | SecurityCollection collection = new SecurityCollection(); 34 | collection.addPattern("/*"); 35 | constraint.addCollection(collection); 36 | context.addConstraint(constraint); 37 | } 38 | }; 39 | tomcat.addAdditionalTomcatConnectors(httpConnector()); 40 | return tomcat; 41 | } 42 | 43 | @Bean 44 | public Connector httpConnector() { 45 | Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); 46 | connector.setScheme("http"); 47 | connector.setPort(httpPort); 48 | connector.setSecure(false); 49 | connector.setRedirectPort(httpsPort); 50 | return connector; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 7 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 8 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 10 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 11 | 12 | /** 13 | * @author Y.bear 14 | * @version 创建时间:2018年11月27日 下午3:55:21 类说明 15 | */ 16 | @Configuration 17 | @EnableWebSecurity 18 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 19 | @Autowired 20 | @Qualifier("idpAuthenticationSuccessHandler") 21 | private AuthenticationSuccessHandler successHandler; 22 | @Autowired 23 | @Qualifier("idpAuthenticationFailureHandler") 24 | private AuthenticationFailureHandler failureHandler; 25 | 26 | @Override 27 | protected void configure(HttpSecurity http) throws Exception { 28 | http.formLogin().loginPage("/login").successHandler(successHandler).failureHandler(failureHandler) 29 | .loginProcessingUrl("/authentication/form").permitAll().and().authorizeRequests() 30 | .antMatchers("/login", "/assets/**", "/css/**", "/js/**", "/index", "/register").permitAll() 31 | .antMatchers("/admin/**").hasRole("ADMIN").antMatchers("/officer/**").hasAnyRole("ADMIN", "OFFICER") 32 | .antMatchers("/user/**").hasAnyRole("ADMIN", "OFFICER", "USER").anyRequest().authenticated().and() 33 | .logout().permitAll().and().headers().frameOptions().disable().and().logout().logoutUrl("/logout") 34 | .logoutSuccessUrl("/index").invalidateHttpSession(true); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/IdpAuthenticationFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.AuthenticationException; 6 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 7 | import org.springframework.stereotype.Component; 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 | * @author Y.bear 16 | * @version 创建时间:2018年11月30日 下午4:37:22 类说明 17 | */ 18 | @Component 19 | public class IdpAuthenticationFailureHandler implements AuthenticationFailureHandler { 20 | private Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | @Override 23 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, 24 | AuthenticationException exception) throws IOException, ServletException { 25 | logger.info("登录失败,重定向到Log in 页面"); 26 | response.sendRedirect("/login?error=true"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/IdpAuthenticationSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import com.cqupt.bear.blockchain.common.utils.JsonUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.security.core.GrantedAuthority; 8 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | import java.util.Collection; 16 | 17 | /** 18 | * @author Y.bear 19 | * @version 创建时间:2018年11月30日 下午4:33:42 类说明 20 | */ 21 | @Component 22 | public class IdpAuthenticationSuccessHandler implements AuthenticationSuccessHandler { 23 | private Logger logger = LoggerFactory.getLogger(getClass()); 24 | 25 | @Override 26 | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, 27 | Authentication authentication) throws IOException, ServletException { 28 | Collection authorities = authentication.getAuthorities(); 29 | 30 | String roles = JsonUtils.collectionToJson(authorities); 31 | String name = authentication.getName(); 32 | logger.info("\"" + name + "\"登陆成功!" + roles); 33 | if (roles.contains("ROLE_ADMIN")) { 34 | response.sendRedirect("/admin"); 35 | } else if (roles.contains("ROLE_OFFICER")) { 36 | response.sendRedirect("/officer"); 37 | } else { 38 | response.sendRedirect("/user"); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/Roles.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年12月2日 上午10:22:08 6 | * 类说明 7 | */ 8 | public enum Roles { 9 | ADMIN, OFFICER, USER; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/UserDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.userdetails.User; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.security.crypto.factory.PasswordEncoderFactories; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | import org.springframework.stereotype.Component; 12 | 13 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年11月28日 下午1:19:41 类说明 16 | */ 17 | @Component 18 | public class UserDetailsServiceImpl implements UserDetailsService { 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | @Override 22 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 23 | PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); 24 | String password = encoder.encode("123456"); 25 | logger.info("password:" + password); 26 | Roles role = Roles.USER; 27 | switch (username) { 28 | case "admin": 29 | role = Roles.ADMIN; 30 | break; 31 | 32 | case "officer": 33 | role = Roles.OFFICER; 34 | break; 35 | 36 | case "user": 37 | role = Roles.USER; 38 | break; 39 | } 40 | UserDetails user = User.withUsername(username).password(password).roles(role.toString()).build(); 41 | return user; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/web/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年9月29日 下午3:30:54 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/login") 13 | public class LoginController { 14 | @GetMapping 15 | public String getIndex() { 16 | return "login"; 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/web/StyleGuideController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月29日 下午3:42:00 类说明 9 | */ 10 | @Controller 11 | public class StyleGuideController { 12 | @GetMapping("/styleguide") 13 | public String getStyleguide() { 14 | return "styleguide"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/idp/web/filter/UrlFilter.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web.filter; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.servlet.*; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | 13 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年11月30日 下午6:55:00 类说明 16 | */ 17 | @Component 18 | public class UrlFilter implements Filter { 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | @Override 22 | public void init(FilterConfig filterConfig) throws ServletException { 23 | 24 | logger.info("Url过滤器已启动"); 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 29 | throws IOException, ServletException { 30 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 31 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 32 | String url = httpServletRequest.getRequestURL().toString(); 33 | if (url.startsWith("https://127.0.0.1") || url.startsWith("https://ybear-web") 34 | || url.startsWith("https://www.ybear-web")) { 35 | logger.info(url); 36 | if (url.endsWith(".html")) { 37 | url = url.substring(0, url.length() - 5); 38 | logger.info("成功处理请求中的.html->>" + url); 39 | httpServletResponse.sendRedirect(url); 40 | } else { 41 | chain.doFilter(request, response); 42 | } 43 | } else { 44 | logger.info(url + "异常,被指向301"); 45 | httpServletResponse.setStatus(HttpStatus.MOVED_PERMANENTLY.value()); 46 | } 47 | } 48 | 49 | @Override 50 | public void destroy() { 51 | logger.warn("Url过滤器已销毁"); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/redis/RedisTemplateForSpringBoot.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.redis; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect; 4 | import com.fasterxml.jackson.annotation.PropertyAccessor; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.data.redis.connection.RedisConnectionFactory; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 13 | 14 | /** 15 | * @author Y.bear 16 | * @version 创建时间:2018年9月27日 下午8:25:00 类说明 17 | */ 18 | @Configuration 19 | public class RedisTemplateForSpringBoot { 20 | private final Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { 24 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer( 25 | Object.class); 26 | ObjectMapper om = new ObjectMapper(); 27 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 28 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 29 | jackson2JsonRedisSerializer.setObjectMapper(om); 30 | RedisTemplate template = new RedisTemplate(); 31 | template.setConnectionFactory(redisConnectionFactory); 32 | template.setKeySerializer(jackson2JsonRedisSerializer); 33 | template.setValueSerializer(jackson2JsonRedisSerializer); 34 | template.setHashKeySerializer(jackson2JsonRedisSerializer); 35 | template.setHashValueSerializer(jackson2JsonRedisSerializer); 36 | template.afterPropertiesSet(); 37 | logger.info("RedisTemplate序列化工具转换为:" + jackson2JsonRedisSerializer.getClass().getName()); 38 | return template; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/java/com/cqupt/bear/blockchain/test/Wenku.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.test; 2 | 3 | import java.io.*; 4 | 5 | /** 6 | * @author Y.bear 7 | * @version 创建时间:2018年11月29日 上午10:44:20 类说明 8 | */ 9 | public class Wenku { 10 | public static void main(String[] args) throws IOException { 11 | String fileName = "C:\\Users\\Y.bear\\Desktop\\test.txt"; 12 | readFile(fileName); 13 | 14 | } 15 | 16 | /** 17 | * 读入TXT文件 18 | * 19 | * @throws IOException 20 | */ 21 | public static void readFile(String fileName) throws IOException { 22 | File file = new File(fileName); 23 | BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "gb2312")); 24 | String line = null; 25 | while ((line = br.readLine()) != null) { 26 | String info = line.replaceAll("[^\u4E00-\u9FA5]", ""); 27 | System.out.println(info); 28 | } 29 | br.close(); 30 | } 31 | } -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | url: jdbc:mysql://localhost:3306/blockchain?useUnicode=true&characterEncoding=utf-8&SSL=false 5 | username: root 6 | password: 123 7 | thymeleaf: 8 | cache: false 9 | encoding: UTF-8 10 | prefix: classpath:/templates/ 11 | suffix: .html 12 | mvc: 13 | static-path-pattern: /** 14 | resources: 15 | static-locations: classpath:/static/ 16 | redis: 17 | host: 127.0.0.1 18 | timeout: 100 19 | port: 6379 20 | password: null 21 | lettuce: 22 | pool: 23 | max-wait: 10 24 | max-active: 100 25 | max-idle: 10 26 | min-idle: 0 27 | devtools: 28 | restart: 29 | additional-paths: src/main/java 30 | servlet: 31 | multipart: 32 | max-file-size: 1024MB 33 | max-request-size: 1024MB 34 | enabled: true 35 | logging: 36 | level: 37 | com.cqupt.bear.blockchain: info 38 | org.springframework.security: warn 39 | mybatis: 40 | mapper-locations: classpath:mapper/*.xml 41 | server: 42 | port: 443 43 | ssl: 44 | key-store: MyDSKeyStore.jks 45 | key-store-password: 123456 46 | keyAlias: tomcat 47 | protocol: TLS 48 | key-password: 123456 49 | enabled: true 50 | max-http-header-size: 8192 51 | http.port: 80 52 | web3j: 53 | client-address: http://127.0.0.1:8545 -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/solidity/Ballot.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.22; 2 | 3 | /// @title 委托投票 4 | contract Ballot { 5 | // 这里声明了一个新的复合类型用于稍后的变量 6 | // 它用来表示一个选民 7 | struct Voter { 8 | uint weight; // 计票的权重 9 | bool voted; // 若为真,代表该人已投票 10 | address delegate; // 被委托人 11 | uint vote; // 投票提案的索引 12 | } 13 | 14 | // 提案的类型 15 | struct Proposal { 16 | bytes32 name; // 简称(最长32个字节) 17 | uint voteCount; // 得票数 18 | } 19 | 20 | address public chairperson; 21 | 22 | // 这声明了一个状态变量,为每个可能的地址存储一个 `Voter`。 23 | mapping(address => Voter) public voters; 24 | 25 | // 一个 `Proposal` 结构类型的动态数组 26 | Proposal[] public proposals; 27 | 28 | /// 为 `proposalNames` 中的每个提案,创建一个新的(投票)表决 29 | constructor(bytes32[] proposalNames) public { 30 | chairperson = msg.sender; 31 | voters[chairperson].weight = 1; 32 | //对于提供的每个提案名称, 33 | //创建一个新的 Proposal 对象并把它添加到数组的末尾。 34 | for (uint i = 0; i < proposalNames.length; i++) { 35 | // `Proposal({...})` 创建一个临时 Proposal 对象, 36 | // `proposals.push(...)` 将其添加到 `proposals` 的末尾 37 | proposals.push(Proposal({ 38 | name: proposalNames[i], 39 | voteCount: 0 40 | })); 41 | } 42 | } 43 | 44 | // 授权 `voter` 对这个(投票)表决进行投票 45 | // 只有 `chairperson` 可以调用该函数。 46 | function giveRightToVote(address voter) public { 47 | // 若 `require` 的第一个参数的计算结果为 `false`, 48 | // 则终止执行,撤销所有对状态和以太币余额的改动。 49 | // 在旧版的 EVM 中这曾经会消耗所有 gas,但现在不会了。 50 | // 使用 require 来检查函数是否被正确地调用,是一个好习惯。 51 | // 你也可以在 require 的第二个参数中提供一个对错误情况的解释。 52 | require( 53 | msg.sender == chairperson, 54 | "Only chairperson can give right to vote." 55 | ); 56 | require( 57 | !voters[voter].voted, 58 | "The voter already voted." 59 | ); 60 | require(voters[voter].weight == 0); 61 | voters[voter].weight = 1; 62 | } 63 | 64 | /// 把你的投票委托到投票者 `to`。 65 | function delegate(address to) public { 66 | // 传引用 67 | Voter storage sender = voters[msg.sender]; 68 | require(!sender.voted, "You already voted."); 69 | 70 | require(to != msg.sender, "Self-delegation is disallowed."); 71 | 72 | // 委托是可以传递的,只要被委托者 `to` 也设置了委托。 73 | // 一般来说,这种循环委托是危险的。因为,如果传递的链条太长, 74 | // 则可能需消耗的gas要多于区块中剩余的(大于区块设置的gasLimit), 75 | // 这种情况下,委托不会被执行。 76 | // 而在另一些情况下,如果形成闭环,则会让合约完全卡住。 77 | while (voters[to].delegate != address(0)) { 78 | to = voters[to].delegate; 79 | 80 | // 不允许闭环委托 81 | require(to != msg.sender, "Found loop in delegation."); 82 | } 83 | 84 | // `sender` 是一个引用, 相当于对 `voters[msg.sender].voted` 进行修改 85 | sender.voted = true; 86 | sender.delegate = to; 87 | Voter storage delegate_ = voters[to]; 88 | if (delegate_.voted) { 89 | // 若被委托者已经投过票了,直接增加得票数 90 | proposals[delegate_.vote].voteCount += sender.weight; 91 | } else { 92 | // 若被委托者还没投票,增加委托者的权重 93 | delegate_.weight += sender.weight; 94 | } 95 | } 96 | 97 | /// 把你的票(包括委托给你的票), 98 | /// 投给提案 `proposals[proposal].name`. 99 | function vote(uint proposal) public { 100 | Voter storage sender = voters[msg.sender]; 101 | require(!sender.voted, "Already voted."); 102 | sender.voted = true; 103 | sender.vote = proposal; 104 | 105 | // 如果 `proposal` 超过了数组的范围,则会自动抛出异常,并恢复所有的改动 106 | proposals[proposal].voteCount += sender.weight; 107 | } 108 | 109 | /// @dev 结合之前所有的投票,计算出最终胜出的提案 110 | function winningProposal() public view 111 | returns (uint winningProposal_) 112 | { 113 | uint winningVoteCount = 0; 114 | for (uint p = 0; p < proposals.length; p++) { 115 | if (proposals[p].voteCount > winningVoteCount) { 116 | winningVoteCount = proposals[p].voteCount; 117 | winningProposal_ = p; 118 | } 119 | } 120 | } 121 | 122 | // 调用 winningProposal() 函数以获取提案数组中获胜者的索引,并以此返回获胜者的名称 123 | function winnerName() public view 124 | returns (bytes32 winnerName_) 125 | { 126 | winnerName_ = proposals[winningProposal()].name; 127 | } 128 | } -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain tec.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain tec.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_chain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_chain.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_connection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_connection.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_world.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_world.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_zhihu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/blockchain_zhihu.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/chef_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/chef_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_2.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_3.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/cover_light_4.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/event_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/event_1_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/event_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/event_2_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/event_3_dark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/event_3_dark.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/event_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/event_3_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_10_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_10_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_11_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_11_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_12_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_12_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_1_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_2_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_3_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_4_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_4_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_5_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_5_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_6_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_6_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_7_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_7_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_8_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_8_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/food_9_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/food_9_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/makereservation_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/makereservation_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/signature_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/signature_light.png -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/testimonal_background_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/testimonal_background_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_1_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_2_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/testimonial_3_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/venue_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/venue_1_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/venue_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/venue_2_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/venue_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/venue_3_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/venue_4_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/venue_4_light.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/校名黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/校名黑.png -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/美丽重邮.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/美丽重邮.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/腾飞门.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/腾飞门.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/重庆邮电大学.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/重庆邮电大学.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/重庆邮电大学标准校徽.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/重庆邮电大学标准校徽.png -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/重邮新貌.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/重邮新貌.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/重邮泳池.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/重邮泳池.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/重邮老照片腾飞们.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/重邮老照片腾飞们.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/blockchain/雪后二教.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/blockchain/雪后二教.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/cover_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/cover_1.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/cover_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/cover_2.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/cover_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/cover_3.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/cover_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/cover_4.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_1.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_2.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_3.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_4.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_5.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/assets/styleguide/people_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/assets/styleguide/people_6.jpg -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/css/aquamarine.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Aquamarine Pingendo template (https://templates.pingendo.com) 3 | * Based on: Bootstrap v4.1.3 (https://getbootstrap.com) 4 | * Copyright 2014-2018 Pingendo (https://pingendo.com) 5 | */ 6 | @import url('https://fonts.googleapis.com/css?family=Roboto:200,300,400'); 7 | 8 | 9 | // Options 10 | // 11 | // Quickly modify global styling by enabling or disabling optional features. 12 | 13 | $enable-rounded: true !default; 14 | $enable-shadows: true; 15 | $enable-transitions: true; 16 | $enable-hover-media-query: false; 17 | $enable-grid-classes: true; 18 | $enable-print-styles: true; 19 | 20 | // Variables 21 | // 22 | // Colors 23 | 24 | $theme-colors: ( 25 | primary: #12bbad, 26 | secondary: #4f70ce, 27 | light: #f3f3f3, 28 | dark: #151515, 29 | info: #ccc, 30 | success: #28a745, 31 | warning: #ffc107, 32 | danger: #dc3545 33 | ); 34 | 35 | $body-bg: white; 36 | $body-color: #333; 37 | $body-color-inverse: invert($body-color) !default; 38 | $link-color: #12bbad; 39 | 40 | // Fonts 41 | $font-family-base: Roboto; 42 | $display-font-family: Roboto; 43 | $lead-font-size: 1.30rem; 44 | $font-size-base: 1rem; 45 | $font-weight-light: 300; 46 | $font-weight-normal: 200; 47 | $font-weight-bold: 700; 48 | $font-weight-base: $font-weight-normal; 49 | $line-height-base: 1.5; 50 | $headings-font-family: Roboto; 51 | $headings-font-weight: $font-weight-normal; 52 | $headings-line-height: 1.2; 53 | 54 | 55 | $spacer: 1.5rem; 56 | $container-max-widths: (sm: 540px, md: 720px, lg: 960px, xl: 960px); 57 | 58 | // Components 59 | $border-width: 1px !default; 60 | 61 | // Buttons 62 | $input-btn-padding-y-lg: .55rem; 63 | $input-btn-padding-x-lg: 1.2rem; 64 | $input-btn-padding-x: 1rem !default; 65 | 66 | // Cards 67 | $card-border-width: 0px; 68 | $card-bg: map-get($theme-colors, 'light'); 69 | 70 | // Breadcrumb 71 | $breadcrumb-bg: transparent !default; 72 | 73 | // Carousel 74 | $carousel-caption-width: 100% !default; 75 | $carousel-indicator-height: 6px !default; 76 | 77 | @import 'bootstrap-4.1.3'; 78 | 79 | html, body { 80 | height: 100%; 81 | } 82 | 83 | body > * { 84 | background-position: center; 85 | background-size: cover; 86 | } 87 | 88 | 89 | // Color yiq 90 | @each $name, $value in $theme-colors { 91 | .bg-#{$name} { 92 | color: color-yiq($value); 93 | 94 | input::placeholder { 95 | color: transparentize(color-yiq($value), .2); 96 | } 97 | 98 | .input-group-text { 99 | color: color-yiq($value); 100 | } 101 | } 102 | } 103 | 104 | .cover { 105 | min-height: 100%; 106 | } 107 | 108 | .inset-shadowed { 109 | box-shadow: inset 0px 0px 45px #555; 110 | } 111 | 112 | .shadowed { 113 | box-shadow: 0px 0px 5px #555; 114 | } 115 | 116 | .section-aquamarine { 117 | position: relative; 118 | color: white; 119 | background-size: cover; 120 | background-position: center; 121 | 122 | &:before { 123 | position: absolute; 124 | top: 0px; 125 | left: 0px; 126 | width: 100%; 127 | height: 100%; 128 | content: ' '; 129 | background: linear-gradient(to bottom right, transparentize(theme-color("primary"), 0.1) 0%, transparentize(theme-color("secondary"), 0.1) 100%); 130 | } 131 | } 132 | 133 | .section-dark { 134 | position: relative; 135 | color: map-get($theme-colors, 'light'); 136 | background-size: cover; 137 | background-position: center; 138 | 139 | &:before { 140 | position: absolute; 141 | top: 0px; 142 | left: 0px; 143 | width: 100%; 144 | height: 100%; 145 | content: ' '; 146 | background: rgba(map-get($theme-colors, 'dark'), 0.75); 147 | } 148 | } 149 | 150 | .section-light { 151 | position: relative; 152 | color: map-get($theme-colors, 'dark'); 153 | background-size: cover; 154 | background-position: center; 155 | 156 | &:before { 157 | position: absolute; 158 | top: 0px; 159 | left: 0px; 160 | width: 100%; 161 | height: 100%; 162 | content: ' '; 163 | background: rgba(map-get($theme-colors, 'light'), 0.75); 164 | } 165 | } 166 | 167 | .section-parallax { 168 | background-attachment: fixed; 169 | background-size: cover; 170 | background-position: center; 171 | } 172 | 173 | .bg-aquamarine { 174 | background: linear-gradient(-30deg, transparentize(theme-color("secondary"), 0.1) 0%, transparentize(theme-color("primary"), 0.1) 50%, transparentize(theme-color("primary"), 0.05) 100%); 175 | color: white; 176 | } 177 | 178 | .img-thumbnail { 179 | border: 0px; 180 | padding: 10px; 181 | } 182 | 183 | .carousel { 184 | .carousel-caption { 185 | padding-top: 50px; 186 | padding-bottom: 20px; 187 | bottom: 0px; 188 | background: linear-gradient(transparent 10%, transparentize(theme-color("dark"), 0.05) 100%); 189 | } 190 | 191 | .carousel-control-next, .carousel-control-prev { 192 | opacity: 0.85; 193 | } 194 | 195 | .carousel-indicators { 196 | bottom: 0px; 197 | } 198 | } 199 | 200 | 201 | /* Animate state between .navbar and .navbar-ontop */ 202 | .navbar { 203 | transition: background-color .5s ease-out; 204 | } 205 | 206 | .navbar-ontop { 207 | background-color: transparent !important; 208 | } 209 | 210 | /* Animate on entrance */ 211 | 212 | .animate-in-down { 213 | transition: all 1.3s ease-out; 214 | position: relative; 215 | opacity: 1; 216 | top: 0px; 217 | 218 | &.out-of-viewport { 219 | top: 40px; 220 | opacity: 0; 221 | } 222 | } 223 | 224 | 225 | .animate-in-left { 226 | transition: all 1.0s ease-out; 227 | position: relative; 228 | opacity: 1; 229 | left: 0%; 230 | 231 | &.out-of-viewport { 232 | opacity: 0; 233 | left: -5%; 234 | } 235 | } 236 | 237 | 238 | .animate-in-right { 239 | transition: all 1.0s ease-out; 240 | position: relative; 241 | opacity: 1; 242 | left: 0%; 243 | 244 | &.out-of-viewport { 245 | opacity: 0; 246 | left: 5%; 247 | } 248 | } -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/js/amap.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/blockchain_springboot/src/main/resources/static/js/amap.js -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/js/animate-in.js: -------------------------------------------------------------------------------- 1 | /** 2 | * animate-in.js 1.0.0 3 | * Animate elements on entrance 4 | * 5 | * Usage: 6 | * 7 | * Make sure to add this to the of your page to avoid flickering on load 8 | * Based on https://andycaygill.github.io/scroll-entrance/ 9 | */ 10 | (function () { 11 | 12 | //Set up defaults 13 | var duration = "1000"; 14 | var heightOffset = 100; 15 | 16 | 17 | // document.write("") 18 | 19 | function isElementVisible(elem) { 20 | 21 | var rect = elem.getBoundingClientRect(); 22 | 23 | //Return true if any of the following conditions are met: 24 | return ( 25 | // The top is in view: the top is more than 0 and less than the window height (the top of the element is in view) 26 | ((rect.top + heightOffset) >= 0 && (rect.top + heightOffset) <= window.innerHeight) || 27 | // The bottom is in view: bottom position is greater than 0 and greater than the window height 28 | ((rect.bottom + heightOffset) >= 0 && (rect.bottom + heightOffset) <= window.innerHeight) || 29 | // The top is above the viewport and the bottom is below the viewport 30 | ((rect.top + heightOffset) < 0 && (rect.bottom + heightOffset) > window.innerHeight) 31 | ) 32 | 33 | } 34 | 35 | 36 | function update() { 37 | var nodes = document.querySelectorAll("*:not(.animate-in-done)[class^='animate-in'], *:not(.animate-in-done)[class*=' animate-in']") 38 | 39 | for (var i = 0; i < nodes.length; i++) { 40 | if (isElementVisible(nodes[i])) { 41 | nodes[i].classList.remove("out-of-viewport") 42 | nodes[i].classList.add("animate-in-done") 43 | } else { 44 | nodes[i].classList.add("out-of-viewport") 45 | } 46 | } 47 | } 48 | 49 | document.addEventListener("DOMContentLoaded", function (event) { 50 | update() 51 | // setTimeout(function() { 52 | // document.querySelector("#temp-animate-in").remove() 53 | // }) 54 | }); 55 | 56 | window.addEventListener("scroll", function () { 57 | update() 58 | }) 59 | 60 | })(); 61 | 62 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/js/navbar-ontop.js: -------------------------------------------------------------------------------- 1 | /** 2 | * navbar-ontop.js 1.0.0 3 | * Add .navbar-ontop class to navbar when the page is scrolled to top 4 | * Make sure to add this script to the of page to avoid flickering on load 5 | */ 6 | 7 | (function () { 8 | 9 | var className = "navbar-ontop" 10 | 11 | // we start hidden, to avoid flickering 12 | document.write("") 13 | 14 | function update() { 15 | // toggle className based on the scrollTop property of document 16 | var nav = document.querySelector(".navbar") 17 | 18 | if (window.scrollY > 15) 19 | nav.classList.remove(className) 20 | else 21 | nav.classList.add(className) 22 | } 23 | 24 | document.addEventListener("DOMContentLoaded", function (event) { 25 | $(window).on('show.bs.collapse', function (e) { 26 | $(e.target).closest("." + className).removeClass(className); 27 | }) 28 | 29 | $(window).on('hidden.bs.collapse', function (e) { 30 | update() 31 | }) 32 | update() 33 | // still hacking to avoid flickering 34 | setTimeout(function () { 35 | document.querySelector("#temp-navbar-ontop").remove() 36 | }) 37 | }); 38 | 39 | window.addEventListener("scroll", function () { 40 | update() 41 | }) 42 | 43 | })(); -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/static/js/smooth-scroll.js: -------------------------------------------------------------------------------- 1 | /** 2 | * smooth-scroll.js 1.0.0 3 | * Make your page scrolling smooth 4 | * Requires JQuery - Does not work with JQuery slim 5 | * Based on https://css-tricks.com/snippets/jquery/smooth-scrolling/ 6 | */ 7 | 8 | (function () { 9 | 10 | var duration = 500 11 | 12 | $('a[href*="#"]') 13 | // Remove links that don't actually link to anything 14 | .not('[href="#"]') 15 | .click(function (event) { 16 | // On-page links 17 | if ( 18 | location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 19 | && 20 | location.hostname == this.hostname 21 | ) { 22 | // Figure out element to scroll to 23 | var target = $(this.hash); 24 | target = target.length ? target : $('[name=' + this.hash.slice(1) + ']') 25 | // Does a scroll target exist? 26 | if (target.length) { 27 | // Only prevent default if animation is actually gonna happen 28 | event.preventDefault() 29 | 30 | $('html, body').animate({ 31 | scrollTop: target.offset().top 32 | }, 33 | duration, function () { 34 | // Callback after animation 35 | // Must change focus! 36 | var $target = $(target); 37 | $target.focus(); 38 | if ($target.is(":focus")) { // Checking if the target was focused 39 | return false; 40 | } else { 41 | $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable 42 | $target.focus(); // Set focus again 43 | } 44 | ; 45 | }); 46 | } 47 | } 48 | }); 49 | 50 | })(); 51 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 |
15 |
16 |
17 |
18 |

Wrong!!!

19 |

Has taken possession of my entire soul, like these sweet mornings of spring which I 20 | enjoy with my whole heart. I am alone, and feel the charm of existence.

返回主页 22 | 投诉 23 |
24 |
25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 |

Y.bear

33 |

A company for whatever you may need, from evidence preservation to protection

34 |
35 |
36 |

Mapsite

37 | 40 |
41 |
42 |

Contact

43 |

44 | +86 - 18883285384

45 |

46 | yu.jack.bear@gmail.com

47 |

48 | Chongqing University of Posts and 49 | Telecommunications

50 |
51 |
52 |

Subscribe

53 |
54 |
56 | 57 |
58 |
59 |
60 |
61 |
62 |

© Copyright 2018 Y.Bear- All rights reserved.

63 |
64 |
65 |
66 |
67 | 70 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /blockchain_springboot/src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 37 |
39 |
40 |
41 |
42 |

Log in

43 |
44 |
46 |
48 | 49 | 用户名或密码错误 Recover 50 | password 51 | 52 |
53 | 54 |
55 |
56 |
57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 |

Contact

65 |

66 | +86 18883285384

67 |

yu.jack.bear@gmail.com

68 |
69 | 75 |
76 |
77 |
78 | 81 |
82 |
83 |
84 |
85 |

© Copyright 2018 Y.bear - All rights reserved.

86 |
87 |
88 |
89 |
90 | 93 | < 94 | script 95 | src = "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" 96 | integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 97 | crossorigin = "anonymous" 98 | style = "" > 99 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /blockchain_springboot/src/test/java/com/cqupt/bear/blockchain/BlockchainApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class BlockchainApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.cqupt.bear 8 | blockchain 9 | 0.0.1-SNAPSHOT 10 | jar 11 | 12 | blockchain 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.5.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-aop 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-data-redis 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-starter-thymeleaf 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-web 43 | 44 | 45 | org.mybatis.spring.boot 46 | mybatis-spring-boot-starter 47 | 1.3.2 48 | 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-devtools 53 | runtime 54 | 55 | 56 | mysql 57 | mysql-connector-java 58 | runtime 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-starter-test 63 | test 64 | 65 | 66 | org.apache.commons 67 | commons-pool2 68 | 69 | 70 | 71 | org.mybatis.spring.boot 72 | mybatis-spring-boot-starter-test 73 | 1.3.2 74 | 75 | 76 | org.springframework.boot 77 | spring-boot-configuration-processor 78 | true 79 | 80 | 81 | 82 | 83 | com.google.code.gson 84 | gson 85 | 86 | 87 | 88 | org.apache.poi 89 | poi 90 | 3.17 91 | 92 | 93 | 94 | org.apache.poi 95 | poi-ooxml 96 | 3.17 97 | 98 | 99 | 100 | org.jsoup 101 | jsoup 102 | 1.11.3 103 | 104 | 105 | org.springframework.boot 106 | spring-boot-starter-security 107 | 108 | 109 | org.thymeleaf.extras 110 | thymeleaf-extras-springsecurity4 111 | 112 | 113 | org.web3j 114 | web3j-spring-boot-starter 115 | 1.6.0 116 | 117 | 118 | io.springfox 119 | springfox-swagger2 120 | 2.9.2 121 | 122 | 123 | io.springfox 124 | springfox-swagger-ui 125 | 2.9.2 126 | 127 | 128 | 129 | 130 | 131 | org.springframework.boot 132 | spring-boot-maven-plugin 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | jdk-1.8 142 | 143 | true 144 | 1.8 145 | 146 | 147 | 1.8 148 | 1.8 149 | 1.8 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/BlockchainApplication.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain; 2 | 3 | import org.apache.tomcat.util.buf.HexUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.web3j.protocol.Web3j; 10 | import org.web3j.protocol.core.DefaultBlockParameterName; 11 | import org.web3j.protocol.core.methods.request.Transaction; 12 | import org.web3j.protocol.core.methods.response.EthCoinbase; 13 | import org.web3j.protocol.core.methods.response.EthGetTransactionCount; 14 | 15 | import javax.annotation.PostConstruct; 16 | import java.io.IOException; 17 | import java.math.BigInteger; 18 | 19 | @SpringBootApplication 20 | public class BlockchainApplication { 21 | private final Logger LOGGER = LoggerFactory.getLogger(getClass()); 22 | 23 | private final Web3j web3j; 24 | 25 | public static void main(String[] args) { 26 | SpringApplication.run(BlockchainApplication.class, args); 27 | } 28 | 29 | @Autowired 30 | public BlockchainApplication(Web3j web3j) { 31 | super(); 32 | this.web3j = web3j; 33 | } 34 | 35 | @PostConstruct 36 | public void listen() { 37 | web3j.transactionObservable().subscribe(tx -> { 38 | LOGGER.info("New tx: id={}, block={}, from={}, to={}, value={},data={}", tx.getHash(), tx.getBlockHash(), 39 | tx.getFrom(), tx.getTo(), tx.getValue().intValue(), 40 | new String(HexUtils.fromHexString(tx.getInput().substring(2)))); 41 | try { 42 | EthCoinbase coinbase = web3j.ethCoinbase().send(); 43 | EthGetTransactionCount transactionCount = web3j 44 | .ethGetTransactionCount(tx.getFrom(), DefaultBlockParameterName.LATEST).send(); 45 | LOGGER.info("Tx count: {}", transactionCount.getTransactionCount().intValue()); 46 | if (transactionCount.getTransactionCount().intValue() % 10 == 0) { 47 | 48 | EthGetTransactionCount tc = web3j 49 | .ethGetTransactionCount(coinbase.getAddress(), DefaultBlockParameterName.LATEST).send(); 50 | Transaction transaction = Transaction.createEtherTransaction(coinbase.getAddress(), 51 | tc.getTransactionCount(), tx.getValue(), BigInteger.valueOf(21_000), tx.getFrom(), 52 | tx.getValue()); 53 | web3j.ethSendTransaction(transaction).send(); 54 | } 55 | } catch (IOException e) { 56 | LOGGER.error("Error getting transactions", e); 57 | } 58 | }); 59 | LOGGER.info("Subscribed"); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/aspect/entity/RequestLog.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.aspect.entity; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * @author Y.bear 7 | * @version 创建时间:2018年9月1日 下午2:16:54 类说明 8 | */ 9 | public class RequestLog { 10 | private String url; 11 | private String ip; 12 | private String classMethod; 13 | private Object[] args; 14 | 15 | public RequestLog(String url, String ip, String classMethod, Object[] args) { 16 | super(); 17 | this.url = url; 18 | this.ip = ip; 19 | this.classMethod = classMethod; 20 | this.args = args; 21 | } 22 | 23 | public String getUrl() { 24 | return url; 25 | } 26 | 27 | public void setUrl(String url) { 28 | this.url = url; 29 | } 30 | 31 | public String getIp() { 32 | return ip; 33 | } 34 | 35 | public void setIp(String ip) { 36 | this.ip = ip; 37 | } 38 | 39 | public String getClassMethod() { 40 | return classMethod; 41 | } 42 | 43 | public void setClassMethod(String classMethod) { 44 | this.classMethod = classMethod; 45 | } 46 | 47 | public Object[] getArgs() { 48 | return args; 49 | } 50 | 51 | public void setArgs(Object[] args) { 52 | this.args = args; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "RequestLog [url=" + url + ", ip=" + ip + ", classMethod=" + classMethod + ", args=" 58 | + Arrays.toString(args) + "]"; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/aspect/service/LogAspect.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.aspect.service; 2 | 3 | import com.cqupt.bear.blockchain.aspect.entity.RequestLog; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.annotation.Aspect; 6 | import org.aspectj.lang.annotation.Before; 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 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年9月1日 下午2:07:56 类说明 16 | */ 17 | @Aspect 18 | @Component 19 | public class LogAspect { 20 | private final Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | // @Pointcut("execution(* com.cqupt.bear.blockchain.*.web.*.*(..))") 23 | // public void log() { 24 | // 25 | // } 26 | 27 | @Before("execution(* com.cqupt.bear.blockchain.*.web.*.*(..))") 28 | public void doBefore(JoinPoint joinPoint) { 29 | String classMethod = joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName(); 30 | Object[] args = joinPoint.getArgs(); 31 | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder 32 | .getRequestAttributes(); 33 | String url = requestAttributes.getRequest().getRequestURL().toString(); 34 | String ip = requestAttributes.getRequest().getRemoteAddr(); 35 | RequestLog requestLog = new RequestLog(url, ip, classMethod, args); 36 | logger.info("Request: {} ", requestLog); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年11月27日 下午3:52:02 类说明 10 | * addViewControllers可以方便的实现一个请求直接映射成视图,而无需书写controller 11 | * registry.addViewController("请求路径").setViewName("请求页面文件路径") 12 | */ 13 | 14 | @Configuration 15 | public class WebMvcConfig implements WebMvcConfigurer { 16 | @Override 17 | public void addViewControllers(ViewControllerRegistry registry) { 18 | registry.addViewController("/error").setViewName("error"); 19 | registry.addViewController("/success").setViewName("success"); 20 | registry.addViewController("/index").setViewName("index"); 21 | registry.addViewController("/register").setViewName("register"); 22 | registry.addViewController("/admin").setViewName("admin/adminIndex"); 23 | registry.addViewController("/officer").setViewName("officer/officerIndex"); 24 | registry.addViewController("/user").setViewName("user/userIndex"); 25 | registry.addViewController("/user/upload").setViewName("user/upload"); 26 | registry.addViewController("/user/queryPage").setViewName("user/query"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/constant/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.constant; 2 | 3 | public class ErrorCodes { 4 | public static final String BUSINESS_EXCEPTION = "BUSINESS_EXCEPTION"; 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/exception/BaseException.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.exception; 2 | 3 | public class BaseException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 570191527602767524L; 6 | 7 | private String errorCode; 8 | 9 | private Object[] args; 10 | 11 | public BaseException(String errorCode) { 12 | this.errorCode = errorCode; 13 | } 14 | 15 | public BaseException(String errorCode, Object... args) { 16 | this.errorCode = errorCode; 17 | this.args = args; 18 | } 19 | 20 | public BaseException(String errorCode, Throwable cause) { 21 | super(cause); 22 | this.errorCode = errorCode; 23 | } 24 | 25 | public BaseException(String errorCode, Throwable cause, Object... args) { 26 | super(cause); 27 | this.errorCode = errorCode; 28 | this.args = args; 29 | } 30 | 31 | public String getErrorCode() { 32 | return errorCode; 33 | } 34 | 35 | protected Object[] getArgs() { 36 | return args; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.exception; 2 | 3 | public class BusinessException extends BaseException { 4 | /** 5 | * 6 | */ 7 | private static final long serialVersionUID = -6052969006553501912L; 8 | 9 | public BusinessException(String errorCode) { 10 | super(errorCode); 11 | } 12 | 13 | public BusinessException(String errorCode, Object... args) { 14 | super(errorCode, args); 15 | } 16 | 17 | public BusinessException(String errorCode, Throwable cause) { 18 | super(errorCode, cause); 19 | } 20 | 21 | public BusinessException(String errorCode, Throwable cause, Object... args) { 22 | super(errorCode, cause, args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/ExcelUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import org.apache.poi.ss.usermodel.Cell; 4 | import org.apache.poi.xssf.usermodel.XSSFRow; 5 | import org.apache.poi.xssf.usermodel.XSSFSheet; 6 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; 7 | 8 | import java.io.File; 9 | import java.io.FileInputStream; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | import java.util.Set; 15 | import java.util.TreeMap; 16 | 17 | public class ExcelUtils { 18 | public static void readFromExcel(String fileName) throws IOException { 19 | File file = new File(fileName + ".xlsx"); 20 | FileInputStream fIP = new FileInputStream(file); 21 | // Get the workbook instance for XLSX file 22 | XSSFWorkbook workbook = new XSSFWorkbook(fIP); 23 | if (file.isFile() && file.exists()) { 24 | System.out.println("openworkbook.xlsx file open successfully."); 25 | } else { 26 | System.out.println("Error to open openworkbook.xlsx file."); 27 | } 28 | workbook.close(); 29 | 30 | } 31 | 32 | public static void toExcel(Map map, String fileName, String sheetName) throws IOException { 33 | XSSFWorkbook workbook = new XSSFWorkbook(); 34 | XSSFSheet spreadsheet = workbook.createSheet(sheetName); 35 | Set keyid = map.keySet(); 36 | int rowid = 0; 37 | XSSFRow row; 38 | for (String key : keyid) { 39 | row = spreadsheet.createRow(rowid++); 40 | Object[] objectArr = map.get(key); 41 | int cellid = 0; 42 | for (Object obj : objectArr) { 43 | Cell cell = row.createCell(cellid++); 44 | cell.setCellValue((String) obj); 45 | } 46 | } 47 | // Write the workbook in file system 48 | FileOutputStream out = new FileOutputStream(new File(fileName + ".xlsx")); 49 | workbook.write(out); 50 | out.close(); 51 | workbook.close(); 52 | System.out.println(fileName + ".xlsx written successfully"); 53 | } 54 | 55 | public static void createNewExcel(String fileName) throws IOException { 56 | XSSFWorkbook workbook = new XSSFWorkbook(); 57 | // Create file system using specific name 58 | FileOutputStream out = new FileOutputStream(new File(fileName + ".xlsx")); 59 | // write operation workbook using file out object 60 | workbook.write(out); 61 | out.close(); 62 | workbook.close(); 63 | System.out.println("create " + fileName + " successfully"); 64 | } 65 | 66 | public static void toExcelExample() throws IOException { 67 | // Create blank workbook 68 | XSSFWorkbook workbook = new XSSFWorkbook(); 69 | // Create a blank sheet 70 | XSSFSheet spreadsheet = workbook.createSheet(" Employee Info "); 71 | // Create row object 72 | XSSFRow row; 73 | // This data needs to be written (Object[]) 74 | Map empinfo = new TreeMap(); 75 | empinfo.put("1", new Object[]{"EMP ID", "EMP NAME", "DESIGNATION"}); 76 | empinfo.put("2", new Object[]{"tp01", "Gopal", "Technical Manager"}); 77 | empinfo.put("3", new Object[]{"tp02", "Manisha", "Proof Reader"}); 78 | empinfo.put("4", new Object[]{"tp03", "Masthan", "Technical Writer"}); 79 | empinfo.put("5", new Object[]{"tp04", "Satish", "Technical Writer"}); 80 | empinfo.put("6", new Object[]{"tp05", "Krishna", "Technical Writer"}); 81 | // Iterate over data and write to sheet 82 | Set keyid = empinfo.keySet(); 83 | int rowid = 0; 84 | for (String key : keyid) { 85 | row = spreadsheet.createRow(rowid++); 86 | Object[] objectArr = empinfo.get(key); 87 | int cellid = 0; 88 | for (Object obj : objectArr) { 89 | Cell cell = row.createCell(cellid++); 90 | cell.setCellValue((String) obj); 91 | } 92 | } 93 | // Write the workbook in file system 94 | FileOutputStream out = new FileOutputStream(new File("myTest.xlsx")); 95 | workbook.write(out); 96 | out.close(); 97 | workbook.close(); 98 | System.out.println("Writesheet.xlsx written successfully"); 99 | } 100 | 101 | public static void main(String[] args) { 102 | try { 103 | String fileName = "test"; 104 | String sheetName = "empInfo"; 105 | Map map = new HashMap<>(); 106 | map.put("1", new Object[]{"EMP ID", "EMP NAME", "DESIGNATION"}); 107 | map.put("2", new Object[]{"tp01", "Gopal", "Technical Manager"}); 108 | map.put("3", new Object[]{"tp02", "Manisha", "Proof Reader", "", "完美", " ", "2012.12.12"}); 109 | map.put("4", new Object[]{"tp03", "Masthan", "Technical Writer", "专利权转让"}); 110 | map.put("5", new Object[]{"tp04", "Satish", "Technical Writer"}); 111 | map.put("6", new Object[]{"tp05", "Krishna", "Technical Writer", "test"}); 112 | createNewExcel(fileName); 113 | toExcel(map, fileName, sheetName); 114 | } catch (IOException e) { 115 | System.out.println("异常"); 116 | e.printStackTrace(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/JsonUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.google.gson.*; 6 | import com.google.gson.reflect.TypeToken; 7 | 8 | import java.io.IOException; 9 | import java.util.*; 10 | 11 | public class JsonUtils { 12 | 13 | public static ObjectMapper OBJECT_MAPPER = new ObjectMapper(); 14 | 15 | public static T fromJson(String jsonString, Class valueType) throws IOException { 16 | return OBJECT_MAPPER.readValue(jsonString, valueType); 17 | } 18 | 19 | public static String toJson(Object object) throws JsonProcessingException { 20 | return OBJECT_MAPPER.writeValueAsString(object); 21 | } 22 | 23 | /** 24 | * 将Map转成json 25 | * 26 | * @param map 27 | * @return 28 | */ 29 | public static String mapToJson(Map map) { 30 | Gson gson = new Gson(); 31 | return gson.toJson(map, Map.class); 32 | } 33 | 34 | /** 35 | * 将List转成json 36 | * 37 | * @param list 38 | * @return 39 | */ 40 | public static String collectionToJson(Collection authorities) { 41 | Gson gson = new Gson(); 42 | return gson.toJson(authorities, Collection.class); 43 | } 44 | 45 | /** 46 | * 将Json串转化为list 47 | * 48 | * @param 49 | * @param json 50 | * @return 51 | */ 52 | public static List toList(String json, Class clazz) { 53 | Gson gson = new Gson(); 54 | return gson.fromJson(json, new TypeToken>() { 55 | }.getType()); 56 | 57 | } 58 | 59 | /** 60 | * 依据json字符串返回Map对象 61 | * 62 | * @param json 63 | * @return 64 | */ 65 | public static Map toMap(String json) { 66 | return JsonUtils.toMap(JsonUtils.parseJson(json)); 67 | } 68 | 69 | /** 70 | * 获取JsonObject 71 | * 72 | * @param json 73 | * @return 74 | */ 75 | public static JsonObject parseJson(String json) { 76 | JsonParser parser = new JsonParser(); 77 | JsonObject jsonObj = parser.parse(json).getAsJsonObject(); 78 | return jsonObj; 79 | } 80 | 81 | /** 82 | * 将JSONObjec对象转换成Map-List集合 83 | * 84 | * @param json 85 | * @return 86 | */ 87 | public static Map toMap(JsonObject json) { 88 | Map map = new HashMap(); 89 | Set> entrySet = json.entrySet(); 90 | for (Iterator> iter = entrySet.iterator(); iter.hasNext(); ) { 91 | Map.Entry entry = iter.next(); 92 | String key = entry.getKey(); 93 | Object value = entry.getValue(); 94 | if (value instanceof JsonArray) 95 | map.put((String) key, toList((JsonArray) value)); 96 | else if (value instanceof JsonObject) 97 | map.put((String) key, toMap((JsonObject) value)); 98 | else 99 | map.put((String) key, value); 100 | } 101 | return map; 102 | } 103 | 104 | /** 105 | * 将JSONArray对象转换成List集合 106 | * 107 | * @param json 108 | * @return 109 | */ 110 | public static List toList(JsonArray json) { 111 | List list = new ArrayList(); 112 | for (int i = 0; i < json.size(); i++) { 113 | Object value = json.get(i); 114 | if (value instanceof JsonArray) { 115 | list.add(toList((JsonArray) value)); 116 | } else if (value instanceof JsonObject) { 117 | list.add(toMap((JsonObject) value)); 118 | } else { 119 | list.add(value); 120 | } 121 | } 122 | return list; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/JsoupUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.nodes.Element; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年10月20日 下午12:22:06 类说明 10 | */ 11 | public class JsoupUtils { 12 | /** 13 | * html->dom 14 | * 15 | * @param htmlString 16 | * @return 17 | */ 18 | public static Document getDomFromString(String htmlString) { 19 | Document document = Jsoup.parse(htmlString); 20 | return document; 21 | } 22 | 23 | /** 24 | * 根据id获取value(input) 25 | * 26 | * @param document 27 | * @param id 28 | * @return 29 | */ 30 | public static String getElementById(Document document, String id) { 31 | Element element = document.getElementById(id); 32 | return element.attr("value"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/NullSafeIterable.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | import java.util.Arrays; 4 | import java.util.Iterator; 5 | import java.util.NoSuchElementException; 6 | 7 | public class NullSafeIterable implements Iterable { 8 | private Iterable iterable; 9 | 10 | private T[] array; 11 | 12 | private boolean isArray; 13 | 14 | public NullSafeIterable(Iterable iterable) { 15 | this.iterable = iterable; 16 | } 17 | 18 | public NullSafeIterable(T[] array) { 19 | this.array = array; 20 | this.isArray = true; 21 | } 22 | 23 | public Iterator iterator() { 24 | if (isArray) { 25 | if (array == null) { 26 | return new NullSafeIterator(); 27 | } else { 28 | return Arrays.asList(array).iterator(); 29 | } 30 | } else { 31 | if (iterable == null) { 32 | return new NullSafeIterator(); 33 | } else { 34 | return iterable.iterator(); 35 | } 36 | } 37 | 38 | } 39 | 40 | class NullSafeIterator implements Iterator { 41 | 42 | public boolean hasNext() { 43 | return false; 44 | } 45 | 46 | public T next() { 47 | throw new NoSuchElementException(); 48 | } 49 | 50 | public void remove() { 51 | throw new UnsupportedOperationException(); 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年10月9日 下午2:36:45 类说明 6 | */ 7 | public class StringUtils { 8 | public static String removeFirstAndLast(String s) { 9 | s = s.substring(1, s.length()); 10 | s = s.substring(0, s.length() - 1); 11 | return s; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/common/utils/TradeNoGenerator.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.common.utils; 2 | 3 | /** 4 | * @date 2018年1月19日下午5:26:24 5 | * @description 6 | */ 7 | public class TradeNoGenerator { 8 | public static String generatTradeNo() { 9 | return String.valueOf((int) (Math.random() * 1000000000)); 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/dto/BlockchainTransaction.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.dto; 2 | 3 | public class BlockchainTransaction { 4 | 5 | private String id; 6 | private int fromId; 7 | private int toId; 8 | private long value; 9 | private boolean accepted; 10 | private String data; 11 | 12 | public BlockchainTransaction() { 13 | 14 | } 15 | 16 | public BlockchainTransaction(int fromId, int toId, long value) { 17 | this.fromId = fromId; 18 | this.toId = toId; 19 | this.value = value; 20 | } 21 | 22 | public BlockchainTransaction(String id, int fromId, int toId, long value, boolean accepted, String data) { 23 | super(); 24 | this.id = id; 25 | this.fromId = fromId; 26 | this.toId = toId; 27 | this.value = value; 28 | this.accepted = accepted; 29 | this.data = data; 30 | } 31 | 32 | public String getData() { 33 | return data; 34 | } 35 | 36 | public void setData(String data) { 37 | this.data = data; 38 | } 39 | 40 | public String getId() { 41 | return id; 42 | } 43 | 44 | public void setId(String id) { 45 | this.id = id; 46 | } 47 | 48 | public int getFromId() { 49 | return fromId; 50 | } 51 | 52 | public void setFromId(int fromId) { 53 | this.fromId = fromId; 54 | } 55 | 56 | public int getToId() { 57 | return toId; 58 | } 59 | 60 | public void setToId(int toId) { 61 | this.toId = toId; 62 | } 63 | 64 | public long getValue() { 65 | return value; 66 | } 67 | 68 | public void setValue(long value) { 69 | this.value = value; 70 | } 71 | 72 | public boolean isAccepted() { 73 | return accepted; 74 | } 75 | 76 | public void setAccepted(boolean accepted) { 77 | this.accepted = accepted; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/dto/EvidenceInfo.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.dto; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年12月20日 上午9:51:55 类说明 6 | */ 7 | public class EvidenceInfo { 8 | private String MD5; 9 | private String blockId; 10 | private String transactionId; 11 | private String height; 12 | private BlockchainTransaction transaction; 13 | 14 | public EvidenceInfo(String MD5, String blockId, String transactionId, String height) { 15 | super(); 16 | this.MD5 = MD5; 17 | this.blockId = blockId; 18 | this.transactionId = transactionId; 19 | this.height = height; 20 | } 21 | 22 | public EvidenceInfo(String mD5, String blockId, String transactionId, String height, 23 | BlockchainTransaction transaction) { 24 | super(); 25 | MD5 = mD5; 26 | this.blockId = blockId; 27 | this.transactionId = transactionId; 28 | this.height = height; 29 | this.transaction = transaction; 30 | } 31 | 32 | public String getMD5() { 33 | return MD5; 34 | } 35 | 36 | public BlockchainTransaction getTransaction() { 37 | return transaction; 38 | } 39 | 40 | public void setTransaction(BlockchainTransaction transaction) { 41 | this.transaction = transaction; 42 | } 43 | 44 | public String getBlockId() { 45 | return blockId; 46 | } 47 | 48 | public String getTransactionId() { 49 | return transactionId; 50 | } 51 | 52 | public String getHeight() { 53 | return height; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "EvidenceInfo [MD5=" + MD5 + ", blockId=" + blockId + ", transactionId=" + transactionId + ", height=" 59 | + height + "]"; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/service/BlockService.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.service; 2 | 3 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 4 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年12月17日 上午9:48:54 类说明 面向接口编程,完成基于以太坊和布比区块链的智能合约调用 9 | */ 10 | public interface BlockService { 11 | void depoly(); 12 | 13 | BlockchainTransaction upload(BlockchainTransaction transaction) throws Exception; 14 | 15 | EvidenceInfo query(String blockHash) throws Exception; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/service/Web3jBlockServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.service; 2 | 3 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 4 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 5 | import org.apache.tomcat.util.buf.HexUtils; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | import org.web3j.protocol.Web3j; 11 | import org.web3j.protocol.core.methods.request.Transaction; 12 | import org.web3j.protocol.core.methods.response.EthAccounts; 13 | import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt; 14 | import org.web3j.protocol.core.methods.response.EthSendTransaction; 15 | import org.web3j.protocol.core.methods.response.EthTransaction; 16 | 17 | import java.io.IOException; 18 | 19 | /** 20 | * @author Y.bear 21 | * @version 创建时间:2018年12月30日 上午11:48:24 类说明 22 | */ 23 | @Service 24 | public class Web3jBlockServiceImpl implements BlockService { 25 | private final Logger LOGGER = LoggerFactory.getLogger(getClass()); 26 | @Autowired 27 | private Web3j web3j; 28 | 29 | @Override 30 | public void depoly() { 31 | 32 | } 33 | 34 | @Override 35 | public BlockchainTransaction upload(BlockchainTransaction trx) throws IOException { 36 | EthAccounts accounts = web3j.ethAccounts().send(); 37 | Transaction transaction = Transaction.createEthCallTransaction(accounts.getAccounts().get(trx.getFromId()), 38 | accounts.getAccounts().get(trx.getToId()), HexUtils.toHexString(trx.getData().getBytes("UTF-8"))); 39 | EthSendTransaction response = web3j.ethSendTransaction(transaction).send(); 40 | if (response.getError() != null) { 41 | trx.setAccepted(false); 42 | LOGGER.info("Tx rejected: {}", response.getError().getMessage()); 43 | return trx; 44 | } 45 | trx.setAccepted(true); 46 | String txHash = response.getTransactionHash(); 47 | LOGGER.info("Tx hash: {}", txHash); 48 | trx.setId(txHash); 49 | EthGetTransactionReceipt receipt = web3j.ethGetTransactionReceipt(txHash).send(); 50 | receipt.getTransactionReceipt().ifPresent(transactionReceipt -> LOGGER.info("Tx receipt: {}", 51 | transactionReceipt.getCumulativeGasUsed().intValue())); 52 | return trx; 53 | } 54 | 55 | @Override 56 | public EvidenceInfo query(String txHash) throws Exception { 57 | EthTransaction transaction = web3j.ethGetTransactionByHash(txHash).send(); 58 | String data = new String(HexUtils.fromHexString(transaction.getResult().getInput().substring(2))); 59 | String blockHash = transaction.getResult().getBlockHash(); 60 | String height = transaction.getResult().getBlockNumber().toString(); 61 | LOGGER.info("txHash:" + txHash + "----" + "evidenceInput:" + data); 62 | BlockchainTransaction blockchainTransaction = new BlockchainTransaction(); 63 | blockchainTransaction.setData(data); 64 | EvidenceInfo evidenceInfo = new EvidenceInfo(data, blockHash, txHash, height); 65 | evidenceInfo.setTransaction(blockchainTransaction); 66 | return evidenceInfo; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/web/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月30日 下午7:22:08 9 | * 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/admin") 13 | public class AdminController { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/web/OfficerController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月30日 下午7:25:09 9 | * 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/officer") 13 | public class OfficerController { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/web/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年11月30日 下午7:22:27 6 | * 类说明 7 | */ 8 | public class PublicController { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/evidence/web/UserController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.evidence.web; 2 | 3 | import com.cqupt.bear.blockchain.common.utils.JsonUtils; 4 | import com.cqupt.bear.blockchain.evidence.dto.BlockchainTransaction; 5 | import com.cqupt.bear.blockchain.evidence.dto.EvidenceInfo; 6 | import com.cqupt.bear.blockchain.evidence.service.BlockService; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import org.apache.commons.codec.digest.DigestUtils; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.beans.factory.annotation.Qualifier; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestBody; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.multipart.MultipartFile; 19 | import org.springframework.web.servlet.ModelAndView; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * @author Y.bear 25 | * @version 创建时间:2018年11月30日 下午7:21:57 类说明 26 | */ 27 | @Controller 28 | @RequestMapping("/user") 29 | public class UserController { 30 | private Logger logger = LoggerFactory.getLogger(getClass()); 31 | @Autowired 32 | @Qualifier("web3jBlockServiceImpl") 33 | private BlockService service; 34 | 35 | @PostMapping("/file") 36 | public ModelAndView upload(MultipartFile evidence, ModelAndView modelAndView, String identityCard, String telephone, 37 | String email) throws IllegalStateException, IOException { 38 | String originalFilename = evidence.getOriginalFilename(); 39 | String md5 = DigestUtils.md5Hex(evidence.getBytes()); 40 | // String folder=System.getProperty("user.dir")+"\\evidences"; 41 | // File localFile = new File(folder, originalFilename); 42 | // evidence.transferTo(localFile); 43 | BlockchainTransaction transaction = new BlockchainTransaction(); 44 | transaction.setData(md5); 45 | transaction.setFromId(0); 46 | transaction.setToId(0); 47 | try { 48 | transaction = executeData(transaction); 49 | } catch (Exception e) { 50 | // TODO Auto-generated catch block 51 | e.printStackTrace(); 52 | } 53 | logger.info(transaction.getId()); 54 | EvidenceInfo evidenceInfo = new EvidenceInfo(md5, "0001", transaction.getId().toString(), "0005", transaction); 55 | logger.info("文件:\"" + originalFilename + "\"成功写入," + "相关信息为:" + evidenceInfo.toString()); 56 | String json = JsonUtils.toJson(evidenceInfo); 57 | logger.info(json); 58 | modelAndView.addAllObjects(JsonUtils.toMap(json)); 59 | modelAndView.setViewName("user/uploadSuccess"); 60 | return modelAndView; 61 | } 62 | 63 | public BlockchainTransaction executeData(@RequestBody BlockchainTransaction transaction) throws Exception { 64 | return service.upload(transaction); 65 | } 66 | 67 | @GetMapping("/query") 68 | public ModelAndView queryBlock(String txHash, ModelAndView modelAndView) throws JsonProcessingException { 69 | EvidenceInfo info = null; 70 | if (txHash.startsWith("\"")) { 71 | txHash = txHash.substring(1, txHash.length() - 1); 72 | } 73 | logger.info("查询txHash:" + txHash); 74 | try { 75 | info = service.query(txHash); 76 | } catch (Exception e) { 77 | // TODO Auto-generated catch block 78 | e.printStackTrace(); 79 | } 80 | if (info != null) { 81 | String evidenceInfo = JsonUtils.toJson(info); 82 | modelAndView.addAllObjects(JsonUtils.toMap(evidenceInfo)); 83 | modelAndView.setViewName("user/queryResult"); 84 | } 85 | return modelAndView; 86 | } 87 | 88 | @PostMapping("/query") 89 | public ModelAndView query(String txHash, ModelAndView modelAndView) throws JsonProcessingException { 90 | ModelAndView result = queryBlock(txHash, modelAndView); 91 | return result; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/HttpToHttpsConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config; 2 | 3 | import org.apache.catalina.Context; 4 | import org.apache.catalina.connector.Connector; 5 | import org.apache.tomcat.util.descriptor.web.SecurityCollection; 6 | import org.apache.tomcat.util.descriptor.web.SecurityConstraint; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * @author Y.bear 14 | * @version 创建时间:2018年11月26日 下午3:01:54 类说明 15 | */ 16 | @Configuration 17 | public class HttpToHttpsConfig { 18 | @Value("${http.port}") 19 | int httpPort; 20 | @Value("${server.port}") 21 | int httpsPort; 22 | 23 | /** 24 | * it's for set http url auto change to https 25 | */ 26 | @Bean 27 | public TomcatServletWebServerFactory servletContainer() { 28 | TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { 29 | @Override 30 | protected void postProcessContext(Context context) { 31 | SecurityConstraint constraint = new SecurityConstraint(); 32 | constraint.setUserConstraint("CONFIDENTIAL"); 33 | SecurityCollection collection = new SecurityCollection(); 34 | collection.addPattern("/*"); 35 | constraint.addCollection(collection); 36 | context.addConstraint(constraint); 37 | } 38 | }; 39 | tomcat.addAdditionalTomcatConnectors(httpConnector()); 40 | return tomcat; 41 | } 42 | 43 | @Bean 44 | public Connector httpConnector() { 45 | Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); 46 | connector.setScheme("http"); 47 | connector.setPort(httpPort); 48 | connector.setSecure(false); 49 | connector.setRedirectPort(httpsPort); 50 | return connector; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 7 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 8 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 10 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 11 | 12 | /** 13 | * @author Y.bear 14 | * @version 创建时间:2018年11月27日 下午3:55:21 类说明 15 | */ 16 | @Configuration 17 | @EnableWebSecurity 18 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 19 | @Autowired 20 | @Qualifier("idpAuthenticationSuccessHandler") 21 | private AuthenticationSuccessHandler successHandler; 22 | @Autowired 23 | @Qualifier("idpAuthenticationFailureHandler") 24 | private AuthenticationFailureHandler failureHandler; 25 | 26 | @Override 27 | protected void configure(HttpSecurity http) throws Exception { 28 | http.formLogin().loginPage("/login").successHandler(successHandler).failureHandler(failureHandler) 29 | .loginProcessingUrl("/authentication/form").permitAll().and().authorizeRequests() 30 | .antMatchers("/login", "/assets/**", "/css/**", "/js/**", "/index", "/register").permitAll() 31 | .antMatchers("/admin/**").hasRole("ADMIN").antMatchers("/officer/**").hasAnyRole("ADMIN", "OFFICER") 32 | .antMatchers("/user/**").hasAnyRole("ADMIN", "OFFICER", "USER").anyRequest().authenticated().and() 33 | .logout().permitAll().and().headers().frameOptions().disable().and().logout().logoutUrl("/logout") 34 | .logoutSuccessUrl("/index").invalidateHttpSession(true); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/IdpAuthenticationFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.AuthenticationException; 6 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 7 | import org.springframework.stereotype.Component; 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 | * @author Y.bear 16 | * @version 创建时间:2018年11月30日 下午4:37:22 类说明 17 | */ 18 | @Component 19 | public class IdpAuthenticationFailureHandler implements AuthenticationFailureHandler { 20 | private Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | @Override 23 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, 24 | AuthenticationException exception) throws IOException, ServletException { 25 | logger.info("登录失败,重定向到Log in 页面"); 26 | response.sendRedirect("/login?error=true"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/IdpAuthenticationSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import com.cqupt.bear.blockchain.common.utils.JsonUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.security.core.GrantedAuthority; 8 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | import java.util.Collection; 16 | 17 | /** 18 | * @author Y.bear 19 | * @version 创建时间:2018年11月30日 下午4:33:42 类说明 20 | */ 21 | @Component 22 | public class IdpAuthenticationSuccessHandler implements AuthenticationSuccessHandler { 23 | private Logger logger = LoggerFactory.getLogger(getClass()); 24 | 25 | @Override 26 | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, 27 | Authentication authentication) throws IOException, ServletException { 28 | Collection authorities = authentication.getAuthorities(); 29 | 30 | String roles = JsonUtils.collectionToJson(authorities); 31 | String name = authentication.getName(); 32 | logger.info("\"" + name + "\"登陆成功!" + roles); 33 | if (roles.contains("ROLE_ADMIN")) { 34 | response.sendRedirect("/admin"); 35 | } else if (roles.contains("ROLE_OFFICER")) { 36 | response.sendRedirect("/officer"); 37 | } else { 38 | response.sendRedirect("/user"); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/Roles.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | /** 4 | * @author Y.bear 5 | * @version 创建时间:2018年12月2日 上午10:22:08 6 | * 类说明 7 | */ 8 | public enum Roles { 9 | ADMIN, OFFICER, USER; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/config/authentication/UserDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.config.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.userdetails.User; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.security.crypto.factory.PasswordEncoderFactories; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | import org.springframework.stereotype.Component; 12 | 13 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年11月28日 下午1:19:41 类说明 16 | */ 17 | @Component 18 | public class UserDetailsServiceImpl implements UserDetailsService { 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | @Override 22 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 23 | PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); 24 | String password = encoder.encode("123456"); 25 | logger.info("password:" + password); 26 | Roles role = Roles.USER; 27 | switch (username) { 28 | case "admin": 29 | role = Roles.ADMIN; 30 | break; 31 | 32 | case "officer": 33 | role = Roles.OFFICER; 34 | break; 35 | 36 | case "user": 37 | role = Roles.USER; 38 | break; 39 | } 40 | UserDetails user = User.withUsername(username).password(password).roles(role.toString()).build(); 41 | return user; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/web/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * @author Y.bear 9 | * @version 创建时间:2018年9月29日 下午3:30:54 类说明 10 | */ 11 | @Controller 12 | @RequestMapping("/login") 13 | public class LoginController { 14 | @GetMapping 15 | public String getIndex() { 16 | return "login"; 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/web/StyleGuideController.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * @author Y.bear 8 | * @version 创建时间:2018年11月29日 下午3:42:00 类说明 9 | */ 10 | @Controller 11 | public class StyleGuideController { 12 | @GetMapping("/styleguide") 13 | public String getStyleguide() { 14 | return "styleguide"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/idp/web/filter/UrlFilter.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.idp.web.filter; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.servlet.*; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | 13 | /** 14 | * @author Y.bear 15 | * @version 创建时间:2018年11月30日 下午6:55:00 类说明 16 | */ 17 | @Component 18 | public class UrlFilter implements Filter { 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | @Override 22 | public void init(FilterConfig filterConfig) throws ServletException { 23 | 24 | logger.info("Url过滤器已启动"); 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 29 | throws IOException, ServletException { 30 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 31 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 32 | String url = httpServletRequest.getRequestURL().toString(); 33 | if (url.startsWith("https://127.0.0.1") || url.startsWith("https://ybear-web") 34 | || url.startsWith("https://www.ybear-web")) { 35 | logger.info(url); 36 | if (url.endsWith(".html")) { 37 | url = url.substring(0, url.length() - 5); 38 | logger.info("成功处理请求中的.html->>" + url); 39 | httpServletResponse.sendRedirect(url); 40 | } else { 41 | chain.doFilter(request, response); 42 | } 43 | } else { 44 | logger.info(url + "异常,被指向301"); 45 | httpServletResponse.setStatus(HttpStatus.MOVED_PERMANENTLY.value()); 46 | } 47 | } 48 | 49 | @Override 50 | public void destroy() { 51 | logger.warn("Url过滤器已销毁"); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/redis/RedisTemplateForSpringBoot.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.redis; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect; 4 | import com.fasterxml.jackson.annotation.PropertyAccessor; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.data.redis.connection.RedisConnectionFactory; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 13 | 14 | /** 15 | * @author Y.bear 16 | * @version 创建时间:2018年9月27日 下午8:25:00 类说明 17 | */ 18 | @Configuration 19 | public class RedisTemplateForSpringBoot { 20 | private final Logger logger = LoggerFactory.getLogger(getClass()); 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { 24 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer( 25 | Object.class); 26 | ObjectMapper om = new ObjectMapper(); 27 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 28 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 29 | jackson2JsonRedisSerializer.setObjectMapper(om); 30 | RedisTemplate template = new RedisTemplate(); 31 | template.setConnectionFactory(redisConnectionFactory); 32 | template.setKeySerializer(jackson2JsonRedisSerializer); 33 | template.setValueSerializer(jackson2JsonRedisSerializer); 34 | template.setHashKeySerializer(jackson2JsonRedisSerializer); 35 | template.setHashValueSerializer(jackson2JsonRedisSerializer); 36 | template.afterPropertiesSet(); 37 | logger.info("RedisTemplate序列化工具转换为:" + jackson2JsonRedisSerializer.getClass().getName()); 38 | return template; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cqupt/bear/blockchain/test/Wenku.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain.test; 2 | 3 | import java.io.*; 4 | 5 | /** 6 | * @author Y.bear 7 | * @version 创建时间:2018年11月29日 上午10:44:20 类说明 8 | */ 9 | public class Wenku { 10 | public static void main(String[] args) throws IOException { 11 | String fileName = "C:\\Users\\Y.bear\\Desktop\\test.txt"; 12 | readFile(fileName); 13 | 14 | } 15 | 16 | /** 17 | * 读入TXT文件 18 | * 19 | * @throws IOException 20 | */ 21 | public static void readFile(String fileName) throws IOException { 22 | File file = new File(fileName); 23 | BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "gb2312")); 24 | String line = null; 25 | while ((line = br.readLine()) != null) { 26 | String info = line.replaceAll("[^\u4E00-\u9FA5]", ""); 27 | System.out.println(info); 28 | } 29 | br.close(); 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | url: jdbc:mysql://localhost:3306/blockchain?useUnicode=true&characterEncoding=utf-8&SSL=false 5 | username: root 6 | password: 123 7 | thymeleaf: 8 | cache: false 9 | encoding: UTF-8 10 | prefix: classpath:/templates/ 11 | suffix: .html 12 | mvc: 13 | static-path-pattern: /** 14 | resources: 15 | static-locations: classpath:/static/ 16 | redis: 17 | host: 127.0.0.1 18 | timeout: 100 19 | port: 6379 20 | password: null 21 | lettuce: 22 | pool: 23 | max-wait: 10 24 | max-active: 100 25 | max-idle: 10 26 | min-idle: 0 27 | devtools: 28 | restart: 29 | additional-paths: src/main/java 30 | servlet: 31 | multipart: 32 | max-file-size: 1024MB 33 | max-request-size: 1024MB 34 | enabled: true 35 | logging: 36 | level: 37 | com.cqupt.bear.blockchain: info 38 | org.springframework.security: warn 39 | mybatis: 40 | mapper-locations: classpath:mapper/*.xml 41 | server: 42 | port: 443 43 | ssl: 44 | key-store: MyDSKeyStore.jks 45 | key-store-password: 123456 46 | keyAlias: tomcat 47 | protocol: TLS 48 | key-password: 123456 49 | enabled: true 50 | max-http-header-size: 8192 51 | http.port: 80 52 | web3j: 53 | client-address: http://127.0.0.1:8545 -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/blockchain tec.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/blockchain tec.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/blockchain_chain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/blockchain_chain.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/blockchain_connection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/blockchain_connection.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/blockchain_world.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/blockchain_world.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/blockchain_zhihu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/blockchain_zhihu.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/chef_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/chef_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/cover_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/cover_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/cover_light_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/cover_light_2.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/cover_light_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/cover_light_3.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/cover_light_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/cover_light_4.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/event_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/event_1_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/event_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/event_2_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/event_3_dark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/event_3_dark.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/event_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/event_3_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_10_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_10_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_11_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_11_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_12_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_12_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_1_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_2_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_3_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_4_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_4_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_5_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_5_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_6_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_6_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_7_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_7_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_8_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_8_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/food_9_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/food_9_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/makereservation_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/makereservation_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/signature_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/signature_light.png -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/testimonal_background_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/testimonal_background_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/testimonial_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/testimonial_1_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/testimonial_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/testimonial_2_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/testimonial_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/testimonial_3_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/venue_1_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/venue_1_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/venue_2_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/venue_2_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/venue_3_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/venue_3_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/venue_4_light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/venue_4_light.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/校名黑.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/校名黑.png -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/美丽重邮.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/美丽重邮.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/腾飞门.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/腾飞门.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/重庆邮电大学.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/重庆邮电大学.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/重庆邮电大学标准校徽.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/重庆邮电大学标准校徽.png -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/重邮新貌.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/重邮新貌.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/重邮泳池.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/重邮泳池.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/重邮老照片腾飞们.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/重邮老照片腾飞们.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/blockchain/雪后二教.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/blockchain/雪后二教.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/cover_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/cover_1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/cover_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/cover_2.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/cover_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/cover_3.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/cover_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/cover_4.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_2.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_3.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_4.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_5.jpg -------------------------------------------------------------------------------- /src/main/resources/static/assets/styleguide/people_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/assets/styleguide/people_6.jpg -------------------------------------------------------------------------------- /src/main/resources/static/css/aquamarine.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Aquamarine Pingendo template (https://templates.pingendo.com) 3 | * Based on: Bootstrap v4.1.3 (https://getbootstrap.com) 4 | * Copyright 2014-2018 Pingendo (https://pingendo.com) 5 | */ 6 | @import url('https://fonts.googleapis.com/css?family=Roboto:200,300,400'); 7 | 8 | 9 | // Options 10 | // 11 | // Quickly modify global styling by enabling or disabling optional features. 12 | 13 | $enable-rounded: true !default; 14 | $enable-shadows: true; 15 | $enable-transitions: true; 16 | $enable-hover-media-query: false; 17 | $enable-grid-classes: true; 18 | $enable-print-styles: true; 19 | 20 | // Variables 21 | // 22 | // Colors 23 | 24 | $theme-colors: ( 25 | primary: #12bbad, 26 | secondary: #4f70ce, 27 | light: #f3f3f3, 28 | dark: #151515, 29 | info: #ccc, 30 | success: #28a745, 31 | warning: #ffc107, 32 | danger: #dc3545 33 | ); 34 | 35 | $body-bg: white; 36 | $body-color: #333; 37 | $body-color-inverse: invert($body-color) !default; 38 | $link-color: #12bbad; 39 | 40 | // Fonts 41 | $font-family-base: Roboto; 42 | $display-font-family: Roboto; 43 | $lead-font-size: 1.30rem; 44 | $font-size-base: 1rem; 45 | $font-weight-light: 300; 46 | $font-weight-normal: 200; 47 | $font-weight-bold: 700; 48 | $font-weight-base: $font-weight-normal; 49 | $line-height-base: 1.5; 50 | $headings-font-family: Roboto; 51 | $headings-font-weight: $font-weight-normal; 52 | $headings-line-height: 1.2; 53 | 54 | 55 | $spacer: 1.5rem; 56 | $container-max-widths: (sm: 540px, md: 720px, lg: 960px, xl: 960px); 57 | 58 | // Components 59 | $border-width: 1px !default; 60 | 61 | // Buttons 62 | $input-btn-padding-y-lg: .55rem; 63 | $input-btn-padding-x-lg: 1.2rem; 64 | $input-btn-padding-x: 1rem !default; 65 | 66 | // Cards 67 | $card-border-width: 0px; 68 | $card-bg: map-get($theme-colors, 'light'); 69 | 70 | // Breadcrumb 71 | $breadcrumb-bg: transparent !default; 72 | 73 | // Carousel 74 | $carousel-caption-width: 100% !default; 75 | $carousel-indicator-height: 6px !default; 76 | 77 | @import 'bootstrap-4.1.3'; 78 | 79 | html, body { 80 | height: 100%; 81 | } 82 | 83 | body > * { 84 | background-position: center; 85 | background-size: cover; 86 | } 87 | 88 | 89 | // Color yiq 90 | @each $name, $value in $theme-colors { 91 | .bg-#{$name} { 92 | color: color-yiq($value); 93 | 94 | input::placeholder { 95 | color: transparentize(color-yiq($value), .2); 96 | } 97 | 98 | .input-group-text { 99 | color: color-yiq($value); 100 | } 101 | } 102 | } 103 | 104 | .cover { 105 | min-height: 100%; 106 | } 107 | 108 | .inset-shadowed { 109 | box-shadow: inset 0px 0px 45px #555; 110 | } 111 | 112 | .shadowed { 113 | box-shadow: 0px 0px 5px #555; 114 | } 115 | 116 | .section-aquamarine { 117 | position: relative; 118 | color: white; 119 | background-size: cover; 120 | background-position: center; 121 | 122 | &:before { 123 | position: absolute; 124 | top: 0px; 125 | left: 0px; 126 | width: 100%; 127 | height: 100%; 128 | content: ' '; 129 | background: linear-gradient(to bottom right, transparentize(theme-color("primary"), 0.1) 0%, transparentize(theme-color("secondary"), 0.1) 100%); 130 | } 131 | } 132 | 133 | .section-dark { 134 | position: relative; 135 | color: map-get($theme-colors, 'light'); 136 | background-size: cover; 137 | background-position: center; 138 | 139 | &:before { 140 | position: absolute; 141 | top: 0px; 142 | left: 0px; 143 | width: 100%; 144 | height: 100%; 145 | content: ' '; 146 | background: rgba(map-get($theme-colors, 'dark'), 0.75); 147 | } 148 | } 149 | 150 | .section-light { 151 | position: relative; 152 | color: map-get($theme-colors, 'dark'); 153 | background-size: cover; 154 | background-position: center; 155 | 156 | &:before { 157 | position: absolute; 158 | top: 0px; 159 | left: 0px; 160 | width: 100%; 161 | height: 100%; 162 | content: ' '; 163 | background: rgba(map-get($theme-colors, 'light'), 0.75); 164 | } 165 | } 166 | 167 | .section-parallax { 168 | background-attachment: fixed; 169 | background-size: cover; 170 | background-position: center; 171 | } 172 | 173 | .bg-aquamarine { 174 | background: linear-gradient(-30deg, transparentize(theme-color("secondary"), 0.1) 0%, transparentize(theme-color("primary"), 0.1) 50%, transparentize(theme-color("primary"), 0.05) 100%); 175 | color: white; 176 | } 177 | 178 | .img-thumbnail { 179 | border: 0px; 180 | padding: 10px; 181 | } 182 | 183 | .carousel { 184 | .carousel-caption { 185 | padding-top: 50px; 186 | padding-bottom: 20px; 187 | bottom: 0px; 188 | background: linear-gradient(transparent 10%, transparentize(theme-color("dark"), 0.05) 100%); 189 | } 190 | 191 | .carousel-control-next, .carousel-control-prev { 192 | opacity: 0.85; 193 | } 194 | 195 | .carousel-indicators { 196 | bottom: 0px; 197 | } 198 | } 199 | 200 | 201 | /* Animate state between .navbar and .navbar-ontop */ 202 | .navbar { 203 | transition: background-color .5s ease-out; 204 | } 205 | 206 | .navbar-ontop { 207 | background-color: transparent !important; 208 | } 209 | 210 | /* Animate on entrance */ 211 | 212 | .animate-in-down { 213 | transition: all 1.3s ease-out; 214 | position: relative; 215 | opacity: 1; 216 | top: 0px; 217 | 218 | &.out-of-viewport { 219 | top: 40px; 220 | opacity: 0; 221 | } 222 | } 223 | 224 | 225 | .animate-in-left { 226 | transition: all 1.0s ease-out; 227 | position: relative; 228 | opacity: 1; 229 | left: 0%; 230 | 231 | &.out-of-viewport { 232 | opacity: 0; 233 | left: -5%; 234 | } 235 | } 236 | 237 | 238 | .animate-in-right { 239 | transition: all 1.0s ease-out; 240 | position: relative; 241 | opacity: 1; 242 | left: 0%; 243 | 244 | &.out-of-viewport { 245 | opacity: 0; 246 | left: 5%; 247 | } 248 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/amap.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ybeario/blockchain_springboot/748baa7b4e0a6678a33e5e0098b5b232e8bc674a/src/main/resources/static/js/amap.js -------------------------------------------------------------------------------- /src/main/resources/static/js/animate-in.js: -------------------------------------------------------------------------------- 1 | /** 2 | * animate-in.js 1.0.0 3 | * Animate elements on entrance 4 | * 5 | * Usage: 6 | * 7 | * Make sure to add this to the of your page to avoid flickering on load 8 | * Based on https://andycaygill.github.io/scroll-entrance/ 9 | */ 10 | (function () { 11 | 12 | //Set up defaults 13 | var duration = "1000"; 14 | var heightOffset = 100; 15 | 16 | 17 | // document.write("") 18 | 19 | function isElementVisible(elem) { 20 | 21 | var rect = elem.getBoundingClientRect(); 22 | 23 | //Return true if any of the following conditions are met: 24 | return ( 25 | // The top is in view: the top is more than 0 and less than the window height (the top of the element is in view) 26 | ((rect.top + heightOffset) >= 0 && (rect.top + heightOffset) <= window.innerHeight) || 27 | // The bottom is in view: bottom position is greater than 0 and greater than the window height 28 | ((rect.bottom + heightOffset) >= 0 && (rect.bottom + heightOffset) <= window.innerHeight) || 29 | // The top is above the viewport and the bottom is below the viewport 30 | ((rect.top + heightOffset) < 0 && (rect.bottom + heightOffset) > window.innerHeight) 31 | ) 32 | 33 | } 34 | 35 | 36 | function update() { 37 | var nodes = document.querySelectorAll("*:not(.animate-in-done)[class^='animate-in'], *:not(.animate-in-done)[class*=' animate-in']") 38 | 39 | for (var i = 0; i < nodes.length; i++) { 40 | if (isElementVisible(nodes[i])) { 41 | nodes[i].classList.remove("out-of-viewport") 42 | nodes[i].classList.add("animate-in-done") 43 | } else { 44 | nodes[i].classList.add("out-of-viewport") 45 | } 46 | } 47 | } 48 | 49 | document.addEventListener("DOMContentLoaded", function (event) { 50 | update() 51 | // setTimeout(function() { 52 | // document.querySelector("#temp-animate-in").remove() 53 | // }) 54 | }); 55 | 56 | window.addEventListener("scroll", function () { 57 | update() 58 | }) 59 | 60 | })(); 61 | 62 | -------------------------------------------------------------------------------- /src/main/resources/static/js/navbar-ontop.js: -------------------------------------------------------------------------------- 1 | /** 2 | * navbar-ontop.js 1.0.0 3 | * Add .navbar-ontop class to navbar when the page is scrolled to top 4 | * Make sure to add this script to the of page to avoid flickering on load 5 | */ 6 | 7 | (function () { 8 | 9 | var className = "navbar-ontop" 10 | 11 | // we start hidden, to avoid flickering 12 | document.write("") 13 | 14 | function update() { 15 | // toggle className based on the scrollTop property of document 16 | var nav = document.querySelector(".navbar") 17 | 18 | if (window.scrollY > 15) 19 | nav.classList.remove(className) 20 | else 21 | nav.classList.add(className) 22 | } 23 | 24 | document.addEventListener("DOMContentLoaded", function (event) { 25 | $(window).on('show.bs.collapse', function (e) { 26 | $(e.target).closest("." + className).removeClass(className); 27 | }) 28 | 29 | $(window).on('hidden.bs.collapse', function (e) { 30 | update() 31 | }) 32 | update() 33 | // still hacking to avoid flickering 34 | setTimeout(function () { 35 | document.querySelector("#temp-navbar-ontop").remove() 36 | }) 37 | }); 38 | 39 | window.addEventListener("scroll", function () { 40 | update() 41 | }) 42 | 43 | })(); -------------------------------------------------------------------------------- /src/main/resources/static/js/smooth-scroll.js: -------------------------------------------------------------------------------- 1 | /** 2 | * smooth-scroll.js 1.0.0 3 | * Make your page scrolling smooth 4 | * Requires JQuery - Does not work with JQuery slim 5 | * Based on https://css-tricks.com/snippets/jquery/smooth-scrolling/ 6 | */ 7 | 8 | (function () { 9 | 10 | var duration = 500 11 | 12 | $('a[href*="#"]') 13 | // Remove links that don't actually link to anything 14 | .not('[href="#"]') 15 | .click(function (event) { 16 | // On-page links 17 | if ( 18 | location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 19 | && 20 | location.hostname == this.hostname 21 | ) { 22 | // Figure out element to scroll to 23 | var target = $(this.hash); 24 | target = target.length ? target : $('[name=' + this.hash.slice(1) + ']') 25 | // Does a scroll target exist? 26 | if (target.length) { 27 | // Only prevent default if animation is actually gonna happen 28 | event.preventDefault() 29 | 30 | $('html, body').animate({ 31 | scrollTop: target.offset().top 32 | }, 33 | duration, function () { 34 | // Callback after animation 35 | // Must change focus! 36 | var $target = $(target); 37 | $target.focus(); 38 | if ($target.is(":focus")) { // Checking if the target was focused 39 | return false; 40 | } else { 41 | $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable 42 | $target.focus(); // Set focus again 43 | } 44 | ; 45 | }); 46 | } 47 | } 48 | }); 49 | 50 | })(); 51 | -------------------------------------------------------------------------------- /src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 |
15 |
16 |
17 |
18 |

Wrong!!!

19 |

Has taken possession of my entire soul, like these sweet mornings of spring which I 20 | enjoy with my whole heart. I am alone, and feel the charm of existence.

返回主页 22 | 投诉 23 |
24 |
25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 |

Y.bear

33 |

A company for whatever you may need, from evidence preservation to protection

34 |
35 |
36 |

Mapsite

37 | 40 |
41 |
42 |

Contact

43 |

44 | +86 - 18883285384

45 |

46 | yu.jack.bear@gmail.com

47 |

48 | Chongqing University of Posts and 49 | Telecommunications

50 |
51 |
52 |

Subscribe

53 |
54 |
56 | 57 |
58 |
59 |
60 |
61 |
62 |

© Copyright 2018 Y.Bear- All rights reserved.

63 |
64 |
65 |
66 |
67 | 70 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 37 |
39 |
40 |
41 |
42 |

Log in

43 |
44 |
46 |
48 | 49 | 用户名或密码错误 Recover 50 | password 51 | 52 |
53 | 54 |
55 |
56 |
57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 |

Contact

65 |

66 | +86 18883285384

67 |

yu.jack.bear@gmail.com

68 |
69 | 75 |
76 |
77 |
78 | 81 |
82 |
83 |
84 |
85 |

© Copyright 2018 Y.bear - All rights reserved.

86 |
87 |
88 |
89 |
90 | 93 | < 94 | script 95 | src = "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" 96 | integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 97 | crossorigin = "anonymous" 98 | style = "" > 99 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/test/java/com/cqupt/bear/blockchain/BlockchainApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.cqupt.bear.blockchain; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class BlockchainApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | --------------------------------------------------------------------------------