├── mvc-config ├── readme.md └── src │ └── main │ ├── docker │ └── Dockerfile │ └── java │ └── com │ └── mvc │ └── config │ └── ConfigServerBootstrap.java ├── mvc-sms ├── README.md └── src │ └── main │ ├── resources │ └── logback.xml │ ├── docker │ └── Dockerfile │ └── java │ └── com │ └── mvc │ └── sms │ ├── dto │ ├── MobileDTO.java │ └── MobileValiDTO.java │ ├── config │ ├── SmsConfiguration.java │ └── RedisConfiguration.java │ └── SmsBootstrap.java ├── mvc-admin ├── README.md └── src │ └── main │ ├── resources │ ├── logback.xml │ └── mapper │ │ └── GateLogMapper.xml │ ├── docker │ └── Dockerfile │ └── java │ └── com │ └── mvc │ └── user │ ├── mapper │ ├── GateLogMapper.java │ ├── GroupTypeMapper.java │ ├── ResourceAuthorityMapper.java │ ├── UserMapper.java │ ├── MenuMapper.java │ ├── ElementMapper.java │ └── GroupMapper.java │ ├── rest │ ├── GateLogController.java │ └── GroupTypeController.java │ ├── service │ ├── GroupTypeBiz.java │ ├── ResourceAuthorityBiz.java │ └── GateLogBiz.java │ ├── vo │ ├── GroupTree.java │ └── GroupUsers.java │ ├── entity │ └── JwtAuthenticationRequest.java │ ├── rpc │ ├── LogRest.java │ ├── AuthService.java │ └── UserRest.java │ ├── config │ ├── druid │ │ ├── DruidStatViewServlet.java │ │ └── DruidStatFilter.java │ └── MapperConfiguration.java │ ├── constant │ └── AdminCommonConstant.java │ └── AdminBootstrap.java ├── mvc-user ├── README.md └── src │ └── main │ ├── resources │ ├── logback.xml │ └── mapper │ │ └── GateLogMapper.xml │ ├── docker │ └── Dockerfile │ └── java │ └── com │ └── mvc │ └── user │ ├── mapper │ ├── CoinInfoMapper.java │ ├── CapitalMapper.java │ └── UserMapper.java │ ├── dto │ ├── ForgetDTO.java │ ├── MobileValiDTO.java │ ├── UpdateDTO.java │ ├── UpdatePhoneDTO.java │ ├── UserDTO.java │ ├── PwdCheckDTO.java │ └── TokenDTO.java │ ├── vo │ ├── JwtAuthenticationResponse.java │ ├── GroupTree.java │ ├── UserVO.java │ ├── GroupUsers.java │ └── CapitalVO.java │ ├── config │ ├── Jobs.java │ ├── druid │ │ ├── DruidStatViewServlet.java │ │ └── DruidStatFilter.java │ └── RedisConfiguration.java │ ├── entity │ ├── Capital.java │ ├── CoinInfo.java │ └── User.java │ ├── rpc │ └── service │ │ ├── SmsService.java │ │ ├── EthernumRest.java │ │ └── AuthService.java │ ├── constant │ └── UserCommonConstant.java │ └── UserBootstrap.java ├── README.md ├── mvc-console ├── target │ └── classes │ │ └── logback.xml └── src │ └── main │ ├── resources │ └── logback.xml │ └── java │ └── com │ └── mvc │ └── console │ ├── mapper │ ├── ConfigMapper.java │ ├── CoinInfoMapper.java │ ├── RefundApplicationMapper.java │ ├── LockRecordMapper.java │ └── TransactionMapper.java │ ├── dto │ ├── MobileValiDTO.java │ ├── PwdCheckDTO.java │ ├── DepositeDTO.java │ ├── TransactionDTO.java │ ├── LockRecordDTO.java │ ├── SendTransactionDTO.java │ ├── TokenDTO.java │ └── WithdrawDTO.java │ ├── entity │ ├── LockConfig.java │ ├── Config.java │ ├── Capital.java │ ├── CoinInfo.java │ ├── LockRecord.java │ ├── Transaction.java │ ├── RefundApplication.java │ └── WithdrawConfig.java │ ├── util │ └── ConfigUtil.java │ ├── service │ ├── CoinInfoService.java │ ├── RefundApplicationService.java │ └── CapitalService.java │ ├── rest │ ├── CapitalController.java │ ├── CoinInfoController.java │ ├── ConfigController.java │ └── RefundApplicationController.java │ ├── vo │ ├── JwtAuthenticationResponse.java │ ├── GroupTree.java │ ├── LockRecordVO.java │ ├── TransactionVO.java │ └── CapitalVO.java │ ├── config │ ├── Jobs.java │ ├── druid │ │ ├── DruidStatViewServlet.java │ │ └── DruidStatFilter.java │ └── RedisConfiguration.java │ ├── rpc │ └── service │ │ ├── SmsService.java │ │ ├── EthernumService.java │ │ └── UserService.java │ ├── constant │ └── UserCommonConstant.java │ └── ConsoleBootstrap.java ├── mvc-admin-console ├── target │ └── classes │ │ └── logback.xml └── src │ └── main │ ├── resources │ └── logback.xml │ └── java │ └── com │ └── mvc │ └── console │ ├── mapper │ ├── ConfigMapper.java │ ├── CoinInfoMapper.java │ └── TransactionMapper.java │ ├── entity │ ├── Config.java │ ├── CoinInfo.java │ └── Transaction.java │ ├── rest │ ├── TransferController.java │ └── ConfigController.java │ ├── rpc │ └── service │ │ └── EthernumService.java │ ├── service │ └── ConfigService.java │ ├── config │ ├── druid │ │ ├── DruidStatViewServlet.java │ │ └── DruidStatFilter.java │ └── MapperConfiguration.java │ ├── constant │ └── UserCommonConstant.java │ ├── util │ └── CoinUtil.java │ └── AdminConsoleBootstrap.java ├── mvc-ethereum └── src │ └── main │ ├── resources │ └── logback.xml │ └── java │ └── com │ └── mvc │ └── ethereum │ ├── model │ ├── dto │ │ ├── NewAccountDTO.java │ │ ├── TransactionCountDTO.java │ │ ├── TransactionByHashDTO.java │ │ ├── PersonalByPrivateKeyDTO.java │ │ ├── RawTransactionDTO.java │ │ ├── ExportAccountDTO.java │ │ ├── ImportRawKeyDTO.java │ │ ├── BalanceDTO.java │ │ └── SendTransactionDTO.java │ ├── Block.java │ ├── NodeConfiguration.java │ ├── Account.java │ ├── Filter.java │ ├── EthTransaction.java │ ├── JsonCredentials.java │ ├── TransactionResponse.java │ ├── TransferEventResponse.java │ ├── ApprovalEventResponse.java │ ├── Method.java │ ├── Capital.java │ ├── CoinInfo.java │ ├── LockRecord.java │ ├── vo │ │ ├── LockRecordVO.java │ │ ├── DepositeCount.java │ │ ├── WithdrawCount.java │ │ ├── AdminBalanceVO.java │ │ ├── TransactionVO.java │ │ └── LockCount.java │ └── Transaction.java │ ├── configuration │ ├── FileConfig.java │ ├── CorsConfig.java │ └── RedisConfiguration.java │ ├── mapper │ ├── CoinInfoMapper.java │ ├── LockRecordMapper.java │ └── CapitalMapper.java │ ├── exceptions │ └── ExceededGasException.java │ ├── service │ └── EtherscanUrl.java │ ├── utils │ ├── FileUtil.java │ └── EthereumUtil.java │ ├── visitor │ ├── AbstractBlockchainVisitor.java │ └── VisitorFactory.java │ └── EthereumApplication.java ├── mvc-center └── src │ └── main │ ├── docker │ └── Dockerfile │ └── java │ └── com │ └── mvc │ └── center │ └── CenterBootstrap.java ├── mvc-auth ├── mvc-auth-server │ └── src │ │ └── main │ │ ├── docker │ │ └── Dockerfile │ │ └── java │ │ └── com │ │ └── mvc │ │ └── auth │ │ ├── mapper │ │ ├── ClientServiceMapper.java │ │ └── ClientMapper.java │ │ ├── biz │ │ └── ClientServiceBiz.java │ │ ├── configuration │ │ ├── UserConfiguration.java │ │ ├── AuthConfiguration.java │ │ ├── FeignConfiguration.java │ │ ├── KeyConfiguration.java │ │ ├── ClientConfiguration.java │ │ └── RedisConfiguration.java │ │ ├── util │ │ ├── user │ │ │ ├── JwtAuthenticationResponse.java │ │ │ ├── JwtUserAuthenticationRequest.java │ │ │ ├── JwtAuthenticationRequest.java │ │ │ └── JwtTokenUtil.java │ │ └── client │ │ │ └── ClientTokenUtil.java │ │ ├── AuthBootstrap.java │ │ ├── feign │ │ └── IUserService.java │ │ ├── service │ │ ├── AuthClientService.java │ │ └── AuthService.java │ │ ├── interceptor │ │ └── ClientTokenInterceptor.java │ │ ├── controller │ │ └── ServiceController.java │ │ └── bean │ │ └── ClientInfo.java ├── mvc-auth-common │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── mvc │ │ └── auth │ │ └── common │ │ ├── util │ │ ├── StringHelper.java │ │ └── jwt │ │ │ └── IJWTInfo.java │ │ ├── event │ │ └── AuthRemoteEvent.java │ │ └── constatns │ │ └── CommonConstants.java ├── mvc-auth-client │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── mvc │ │ └── auth │ │ └── client │ │ ├── exception │ │ ├── JwtSignatureException.java │ │ ├── JwtTokenExpiredException.java │ │ └── JwtIllegalArgumentException.java │ │ ├── annotation │ │ ├── IgnoreUserToken.java │ │ └── IgnoreClientToken.java │ │ ├── EnableAceAuthClient.java │ │ ├── config │ │ └── UserAuthConfig.java │ │ └── configuration │ │ └── AutoConfiguration.java └── pom.xml ├── mvc-common └── src │ └── main │ └── java │ └── com │ └── mvc │ └── common │ ├── constant │ ├── RestMsgConstants.java │ ├── UserConstant.java │ ├── RestCodeConstants.java │ └── CommonConstants.java │ ├── util │ ├── StringHelper.java │ ├── ClientUtil.java │ ├── UUIDUtils.java │ └── Query.java │ ├── dto │ ├── LockRecordDTO.java │ ├── TransactionDTO.java │ ├── TransferDTO.java │ └── BatchTransferDTO.java │ ├── msg │ ├── auth │ │ ├── TokenErrorResponse.java │ │ └── TokenForbiddenResponse.java │ ├── ResultCode.java │ ├── BaseResponse.java │ ├── ObjectRestResponse.java │ ├── Result.java │ ├── ListRestResponse.java │ └── ResultGenerator.java │ ├── exception │ ├── auth │ │ ├── UserInvalidException.java │ │ ├── ClientInvalidException.java │ │ ├── TokenErrorException.java │ │ └── ClientForbiddenException.java │ └── BaseException.java │ ├── annotation │ ├── IgnoreUserToken.java │ └── IgnoreClientToken.java │ └── vo │ └── TreeNode.java ├── mvc-api ├── src │ └── main │ │ └── java │ │ └── com │ │ └── mvc │ │ └── api │ │ └── vo │ │ ├── user │ │ └── NewAccountDTO.java │ │ └── authority │ │ └── PermissionInfo.java └── pom.xml ├── mvc-gate ├── mvc-gate-server │ └── src │ │ └── main │ │ ├── docker │ │ └── Dockerfile │ │ ├── java │ │ └── com │ │ │ └── mvc │ │ │ └── gate │ │ │ ├── feign │ │ │ ├── ILogService.java │ │ │ └── IUserService.java │ │ │ ├── config │ │ │ ├── CorsConfig.java │ │ │ └── UserPrincipal.java │ │ │ └── GateBootstrap.java │ │ └── resources │ │ └── bootstrap.yml ├── mvc-gate-ratelimit │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── mvc │ │ └── gate │ │ └── ratelimit │ │ ├── config │ │ ├── IUserPrincipal.java │ │ ├── repository │ │ │ ├── springdata │ │ │ │ └── IRateLimiterRepository.java │ │ │ └── InMemoryRateLimiter.java │ │ ├── DefaultUserPrincipal.java │ │ └── RateLimiter.java │ │ └── EnableAceGateRateLimit.java └── pom.xml ├── .gitignore └── mysql-backup └── backup.sh /mvc-config/readme.md: -------------------------------------------------------------------------------- 1 | ## 配置服务 -------------------------------------------------------------------------------- /mvc-sms/README.md: -------------------------------------------------------------------------------- 1 | ## 短信服务 -------------------------------------------------------------------------------- /mvc-admin/README.md: -------------------------------------------------------------------------------- 1 | ## 后台用户服务 2 | -------------------------------------------------------------------------------- /mvc-user/README.md: -------------------------------------------------------------------------------- 1 | ## 用户服务 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lock-plat 2 | Lock MVC on platform 3 | -------------------------------------------------------------------------------- /mvc-admin/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-console/target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-sms/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-user/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-admin-console/target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-console/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /mvc-admin/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-admin.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-sms/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-admin.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-user/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-admin.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-center/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-center.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-config/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-config.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM livingobjects/jre8 2 | VOLUME /tmp 3 | ADD ace-auth.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/constant/RestMsgConstants.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.constant; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class RestMsgConstants { 7 | public static final String VALI_IMG_ERR = "验证码输入错误"; 8 | } 9 | -------------------------------------------------------------------------------- /mvc-api/src/main/java/com/mvc/api/vo/user/NewAccountDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.api.vo.user; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class NewAccountDTO { 10 | 11 | private String passphrase; 12 | } 13 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/NewAccountDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class NewAccountDTO { 10 | 11 | private String passphrase; 12 | } 13 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/configuration/FileConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.configuration; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Configuration 9 | public class FileConfig { 10 | } 11 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/TransactionCountDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class TransactionCountDTO { 10 | 11 | private String address; 12 | } 13 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | VOLUME /tmp 3 | ADD ace-gate.jar app.jar 4 | ADD wait-for-it.sh /wait-for-it.sh 5 | RUN sh -c 'touch /app.jar' 6 | RUN bash -c 'chmod 777 /wait-for-it.sh' 7 | CMD exec java -Djava.security.egd=file:/dev/./urandom -jar /app.jar -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/GateLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.GateLog; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface GateLogMapper extends Mapper { 10 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/TransactionByHashDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class TransactionByHashDTO { 10 | private String transactionHash; 11 | } 12 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/mapper/ConfigMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.Config; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface ConfigMapper extends Mapper { 10 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/PersonalByPrivateKeyDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class PersonalByPrivateKeyDTO { 10 | 11 | private String privateKey; 12 | } 13 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/RawTransactionDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class RawTransactionDTO { 10 | 11 | private String signedMessage; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/GroupTypeMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.GroupType; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface GroupTypeMapper extends Mapper { 10 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/util/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.util; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class StringHelper { 7 | public static String getObjectValue(Object obj) { 8 | return obj == null ? "" : obj.toString(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/mapper/CoinInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.CoinInfo; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface CoinInfoMapper extends Mapper { 10 | 11 | } -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/mapper/ConfigMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.Config; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface ConfigMapper extends Mapper { 10 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/constant/UserConstant.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.constant; 2 | 3 | /** 4 | * ${DESCRIPTION} 5 | * 6 | * @author wanghaobin 7 | * @create 2017-06-14 8:36 8 | */ 9 | public class UserConstant { 10 | public static int PW_ENCORDER_SALT = 12; 11 | } 12 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/mapper/CoinInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.CoinInfo; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface CoinInfoMapper extends Mapper { 10 | 11 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/ExportAccountDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class ExportAccountDTO { 10 | private String address; 11 | private String passphrase; 12 | } 13 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/mapper/CoinInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.CoinInfo; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface CoinInfoMapper extends Mapper { 10 | 11 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/constant/RestCodeConstants.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.constant; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class RestCodeConstants { 7 | public static final int TOKEN_ERROR_CODE = 40101; 8 | public static final int TOKEN_FORBIDDEN_CODE = 40301; 9 | } 10 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/mapper/CoinInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.mapper; 2 | 3 | import com.mvc.ethereum.model.CoinInfo; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface CoinInfoMapper extends Mapper { 10 | 11 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/exceptions/ExceededGasException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.exceptions; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class ExceededGasException extends Throwable { 7 | public ExceededGasException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/ImportRawKeyDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | 4 | import lombok.Data; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Data 10 | public class ImportRawKeyDTO { 11 | 12 | private String keydata; 13 | private String passphrase; 14 | } 15 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/ForgetDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * userDTO 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/8 21:55 10 | */ 11 | @Data 12 | public class ForgetDTO extends UserDTO{ 13 | 14 | private String newPassword; 15 | } 16 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-common/src/main/java/com/mvc/auth/common/util/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.common.util; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class StringHelper { 7 | public static String getObjectValue(Object obj) { 8 | return obj == null ? "" : obj.toString(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/service/EtherscanUrl.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.service; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public interface EtherscanUrl { 7 | 8 | public final static String TXLIST = "?module=account&action=txlist&startblock=0&endblock=99999999&sort=asc&address=%s"; 9 | } 10 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/exception/JwtSignatureException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.exception; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class JwtSignatureException extends Exception { 7 | public JwtSignatureException(String s) { 8 | super(s); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/exception/JwtTokenExpiredException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.exception; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class JwtTokenExpiredException extends Exception { 7 | public JwtTokenExpiredException(String s) { 8 | super(s); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/exception/JwtIllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.exception; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class JwtIllegalArgumentException extends Exception { 7 | public JwtIllegalArgumentException(String s) { 8 | super(s); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/mapper/RefundApplicationMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.RefundApplication; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface RefundApplicationMapper extends Mapper { 10 | 11 | } -------------------------------------------------------------------------------- /mvc-sms/src/main/java/com/mvc/sms/dto/MobileDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.sms.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * smsCode 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/8 16:04 12 | */ 13 | @Data 14 | public class MobileDTO { 15 | 16 | private String mobile; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mvc-sms/src/main/java/com/mvc/sms/dto/MobileValiDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.sms.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * smsCode 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/8 16:04 10 | */ 11 | @Data 12 | public class MobileValiDTO { 13 | 14 | private String mobile; 15 | private String valiCode; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/MobileValiDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * smsCode 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/8 16:04 10 | */ 11 | @Data 12 | public class MobileValiDTO { 13 | 14 | private String mobile; 15 | private String valiCode; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/UpdateDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import com.mvc.user.entity.User; 4 | import lombok.Data; 5 | 6 | /** 7 | * userDTO 8 | * 9 | * @author qiyichen 10 | * @create 2018/1/8 21:55 11 | */ 12 | @Data 13 | public class UpdateDTO extends User { 14 | 15 | private String newPassword; 16 | } 17 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/MobileValiDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * smsCode 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/8 16:04 10 | */ 11 | @Data 12 | public class MobileValiDTO { 13 | 14 | private String mobile; 15 | private String valiCode; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/BalanceDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | public class BalanceDTO implements Serializable { 12 | private String address; 13 | private String blockId; 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .settings 3 | .classpath 4 | .project 5 | 6 | .idea/ 7 | *.iml 8 | *.ipr 9 | *.iws 10 | .gradle/ 11 | build/ 12 | mods/ 13 | .idea/libraries 14 | *.DS_Store 15 | 16 | *.class 17 | 18 | *_blockstore 19 | 20 | # Package Files 21 | # *.jar 22 | *.war 23 | *.ear 24 | 25 | # IDEA 26 | *.iml 27 | .idea/ 28 | .DS_Store 29 | local.* 30 | 31 | application.yml -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/UpdatePhoneDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import com.mvc.user.entity.User; 4 | import lombok.Data; 5 | 6 | /** 7 | * update phone dto 8 | * 9 | * @author qiyichen 10 | * @create 2018/1/9 14:10 11 | */ 12 | @Data 13 | public class UpdatePhoneDTO extends UserDTO { 14 | 15 | private String newCellPhone; 16 | } 17 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/PwdCheckDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | 7 | /** 8 | * userDTO 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/8 21:55 12 | */ 13 | @Data 14 | public class PwdCheckDTO { 15 | 16 | private String password; 17 | private BigInteger userId; 18 | } 19 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/dto/LockRecordDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * TransactionDTO 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/15 14:23 10 | */ 11 | @Data 12 | public class LockRecordDTO { 13 | 14 | private Integer pageSize; 15 | private Integer pageNo; 16 | private String key; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/dto/TransactionDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * TransactionDTO 7 | * 8 | * @author qiyichen 9 | * @create 2018/1/15 14:23 10 | */ 11 | @Data 12 | public class TransactionDTO { 13 | 14 | private Integer pageSize; 15 | private Integer pageNo; 16 | private Integer type; 17 | private String key; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/DepositeDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigDecimal; 6 | 7 | /** 8 | * deposite dto 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/10 17:06 12 | */ 13 | @Data 14 | public class DepositeDTO { 15 | 16 | private String type; 17 | private BigDecimal value; 18 | private String password; 19 | } 20 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/mapper/TransactionMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.entity.Transaction; 4 | import tk.mybatis.mapper.common.Mapper; 5 | import tk.mybatis.mapper.common.special.InsertListMapper; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public interface TransactionMapper extends Mapper, InsertListMapper { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/config/IUserPrincipal.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.ratelimit.config; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | public interface IUserPrincipal { 9 | /** 10 | * getName 11 | * 12 | * @param request 13 | * @return 14 | */ 15 | String getName(HttpServletRequest request); 16 | } 17 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/UserDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import com.mvc.user.entity.User; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * userDTO 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/8 21:55 13 | */ 14 | @Data 15 | public class UserDTO extends User{ 16 | 17 | @NotNull(message = "验证码不能为空") 18 | private String valiCode; 19 | } 20 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/auth/TokenErrorResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg.auth; 2 | 3 | import com.mvc.common.constant.RestCodeConstants; 4 | import com.mvc.common.msg.BaseResponse; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public class TokenErrorResponse extends BaseResponse { 10 | public TokenErrorResponse(String message) { 11 | super(RestCodeConstants.TOKEN_ERROR_CODE, message); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/mapper/ClientServiceMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.mapper; 2 | 3 | import com.mvc.auth.entity.ClientService; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface ClientServiceMapper extends Mapper { 10 | 11 | /** 12 | * deleteByServiceId 13 | * 14 | * @param id 15 | */ 16 | void deleteByServiceId(int id); 17 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/auth/TokenForbiddenResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg.auth; 2 | 3 | import com.mvc.common.constant.RestCodeConstants; 4 | import com.mvc.common.msg.BaseResponse; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public class TokenForbiddenResponse extends BaseResponse { 10 | public TokenForbiddenResponse(String message) { 11 | super(RestCodeConstants.TOKEN_FORBIDDEN_CODE, message); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/TransactionDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | 7 | /** 8 | * transaction dto 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/10 12:51 12 | */ 13 | @Data 14 | public class TransactionDTO { 15 | 16 | private Integer pageNo; 17 | private Integer pageSize; 18 | private String types; 19 | private BigInteger userId; 20 | } 21 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/PwdCheckDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import com.mvc.user.entity.User; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | import java.math.BigInteger; 8 | 9 | /** 10 | * userDTO 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/8 21:55 14 | */ 15 | @Data 16 | public class PwdCheckDTO { 17 | 18 | private String password; 19 | private BigInteger userId; 20 | } 21 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/biz/ClientServiceBiz.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.biz; 2 | 3 | import com.mvc.auth.entity.ClientService; 4 | import com.mvc.auth.mapper.ClientServiceMapper; 5 | import com.mvc.common.biz.BaseBiz; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | * @author ace 10 | * @create 2017/12/30. 11 | */ 12 | @Service 13 | public class ClientServiceBiz extends BaseBiz { 14 | } 15 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Block.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import lombok.*; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Builder(builderClassName = "Builder", toBuilder = true) 10 | @Setter 11 | @Getter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | public class Block { 16 | private String nonce; 17 | } 18 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/exception/auth/UserInvalidException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.exception.auth; 2 | 3 | 4 | import com.mvc.common.constant.CommonConstants; 5 | import com.mvc.common.exception.BaseException; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class UserInvalidException extends BaseException { 11 | public UserInvalidException(String message) { 12 | super(message, CommonConstants.EX_USER_INVALID_CODE); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/exception/auth/ClientInvalidException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.exception.auth; 2 | 3 | 4 | import com.mvc.common.constant.CommonConstants; 5 | import com.mvc.common.exception.BaseException; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class ClientInvalidException extends BaseException { 11 | public ClientInvalidException(String message) { 12 | super(message, CommonConstants.EX_CLIENT_INVALID_CODE); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/exception/auth/TokenErrorException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.exception.auth; 2 | 3 | 4 | import com.mvc.common.constant.CommonConstants; 5 | import com.mvc.common.exception.BaseException; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class TokenErrorException extends BaseException { 11 | public TokenErrorException(String message, int status) { 12 | super(message, CommonConstants.EX_TOKEN_ERROR_CODE); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/NodeConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | @ConfigurationProperties 12 | @Component 13 | public class NodeConfiguration { 14 | 15 | private String nodeEndpoint; 16 | private String fromAddress; 17 | } 18 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/EnableAceGateRateLimit.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.ratelimit; 2 | 3 | import org.springframework.context.annotation.Import; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * Created by ace on 2017/9/24. 9 | */ 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Import(RateLimitAutoConfiguration.class) 13 | @Documented 14 | @Inherited 15 | public @interface EnableAceGateRateLimit { 16 | } 17 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/exception/auth/ClientForbiddenException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.exception.auth; 2 | 3 | 4 | import com.mvc.common.constant.CommonConstants; 5 | import com.mvc.common.exception.BaseException; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class ClientForbiddenException extends BaseException { 11 | public ClientForbiddenException(String message) { 12 | super(message, CommonConstants.EX_CLIENT_FORBIDDEN_CODE); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/UserConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author ace 9 | * @create 2017/12/26. 10 | */ 11 | @Configuration 12 | @Data 13 | public class UserConfiguration { 14 | @Value("${jwt.token-header}") 15 | private String userTokenHeader; 16 | } 17 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/annotation/IgnoreUserToken.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 忽略用户鉴权 10 | * Created by ace on 2017/9/27. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(value={ElementType.METHOD,ElementType.TYPE}) 14 | public @interface IgnoreUserToken { 15 | } 16 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/config/repository/springdata/IRateLimiterRepository.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.ratelimit.config.repository.springdata; 2 | 3 | import com.mvc.gate.ratelimit.config.Rate; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Repository 11 | public interface IRateLimiterRepository extends CrudRepository { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/annotation/IgnoreClientToken.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 忽略服务鉴权 10 | * Created by ace on 2017/9/27. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(value={ElementType.METHOD,ElementType.TYPE}) 14 | public @interface IgnoreClientToken { 15 | } 16 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/LockRecordDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import com.mvc.console.entity.LockRecord; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | * LockRecord 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/11 19:44 13 | */ 14 | @Data 15 | public class LockRecordDTO extends LockRecord{ 16 | 17 | private String type; 18 | private BigDecimal value; 19 | private Integer pageNo; 20 | private Integer pageSize; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/SendTransactionDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | public class SendTransactionDTO { 12 | 13 | private String pass; 14 | private String from; 15 | private String to; 16 | private BigInteger gas; 17 | private BigInteger gasPrice; 18 | private BigInteger value; 19 | private String data; 20 | private BigInteger nonce; 21 | 22 | } -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/annotation/IgnoreUserToken.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 忽略用户鉴权 10 | * Created by ace on 2017/9/27. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(value={ElementType.METHOD,ElementType.TYPE}) 14 | public @interface IgnoreUserToken { 15 | } 16 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/dto/TransferDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.dto; 2 | 3 | 4 | import lombok.Data; 5 | import lombok.NonNull; 6 | 7 | import java.math.BigInteger; 8 | 9 | /** 10 | * transfer dto 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/14 14:32 14 | */ 15 | @Data 16 | public class TransferDTO { 17 | 18 | @NonNull 19 | private Float value; 20 | @NonNull 21 | private String address; 22 | @NonNull 23 | private String type; 24 | 25 | private String pass; 26 | } 27 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/TokenDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigInteger; 8 | 9 | /** 10 | * token dto 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 10:55 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class TokenDTO { 19 | private String userName; 20 | private String clientId; 21 | private BigInteger userId; 22 | } 23 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/EnableAceAuthClient.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client; 2 | 3 | import com.mvc.auth.client.configuration.AutoConfiguration; 4 | import org.springframework.context.annotation.Import; 5 | 6 | import java.lang.annotation.*; 7 | 8 | 9 | /** 10 | * Created by ace on 2017/9/15. 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Import(AutoConfiguration.class) 15 | @Documented 16 | @Inherited 17 | public @interface EnableAceAuthClient { 18 | } 19 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/annotation/IgnoreClientToken.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 忽略服务鉴权 10 | * Created by ace on 2017/9/27. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(value={ElementType.METHOD,ElementType.TYPE}) 14 | public @interface IgnoreClientToken { 15 | } 16 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/dto/BatchTransferDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NonNull; 5 | import org.json.JSONArray; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * batchTransfer dto 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/14 14:30 15 | */ 16 | @Data 17 | public class BatchTransferDTO { 18 | 19 | @NonNull 20 | private String type; 21 | @NonNull 22 | private List transferDTOS; 23 | 24 | private String pass; 25 | } 26 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/LockConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigDecimal; 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * LockConfig 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/13 6:30 13 | */ 14 | @Data 15 | public class LockConfig { 16 | 17 | private Integer switchKey; 18 | private String type; 19 | private BigDecimal min; 20 | private BigDecimal max; 21 | private Integer month; 22 | private Float interest; 23 | } 24 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/config/DefaultUserPrincipal.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.ratelimit.config; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | public class DefaultUserPrincipal implements IUserPrincipal { 9 | @Override 10 | public String getName(HttpServletRequest request) { 11 | if (request.getUserPrincipal() == null) { 12 | return null; 13 | } 14 | return request.getUserPrincipal().getName(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/AuthConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 2 | 3 | import com.mvc.common.handler.GlobalExceptionHandler; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Configuration 11 | public class AuthConfiguration { 12 | @Bean 13 | public GlobalExceptionHandler getGlobalExceptionHandler() { 14 | return new GlobalExceptionHandler(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/FeignConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 2 | 3 | import com.mvc.auth.interceptor.ClientTokenInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Configuration 11 | public class FeignConfiguration { 12 | @Bean 13 | ClientTokenInterceptor getClientTokenInterceptor() { 14 | return new ClientTokenInterceptor(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/dto/TokenDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigInteger; 8 | 9 | /** 10 | * token dto 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 10:55 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class TokenDTO { 19 | private String userName; 20 | private String clientId; 21 | private BigInteger userId; 22 | private String address; 23 | } 24 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/rest/GateLogController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.user.entity.GateLog; 5 | import com.mvc.user.service.GateLogBiz; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | /** 10 | * @author qyc 11 | * @create 2017-07-01 20:32 12 | */ 13 | @Controller 14 | @RequestMapping("gateLog") 15 | public class GateLogController extends BaseController { 16 | } 17 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Account.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import lombok.*; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Builder(builderClassName = "Builder", toBuilder = true) 10 | @Setter 11 | @Getter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | @ToString 16 | public class Account { 17 | private String passphrase; 18 | private String address; 19 | private long balance; 20 | } 21 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/service/GroupTypeBiz.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.user.entity.GroupType; 5 | import com.mvc.user.mapper.GroupTypeMapper; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * @author qyc 11 | * @create 2017-06-12 8:48 12 | */ 13 | @Service 14 | @Transactional(rollbackFor = Exception.class) 15 | public class GroupTypeBiz extends BaseBiz { 16 | } 17 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/util/ConfigUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.util; 2 | 3 | import com.mvc.console.entity.LockConfig; 4 | import com.mvc.console.entity.WithdrawConfig; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * config util 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/13 6:27 14 | */ 15 | public class ConfigUtil { 16 | 17 | public static Map lockConfigMap = new HashMap<>(); 18 | public static Map withdrawConfigMap = new HashMap<>(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/dto/SendTransactionDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigDecimal; 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @Data 12 | public class SendTransactionDTO { 13 | 14 | private String pass; 15 | private String from; 16 | private String to; 17 | private BigInteger gas; 18 | private BigInteger gasPrice; 19 | private BigDecimal value; 20 | private String data; 21 | private BigInteger nonce; 22 | 23 | } -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/rest/GroupTypeController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.user.entity.GroupType; 5 | import com.mvc.user.service.GroupTypeBiz; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | /** 10 | * @author qyc 11 | * @create 2017-06-08 11:51 12 | */ 13 | @Controller 14 | @RequestMapping("groupType") 15 | public class GroupTypeController extends BaseController { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-common/src/main/java/com/mvc/auth/common/util/jwt/IJWTInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.common.util.jwt; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public interface IJWTInfo { 7 | /** 8 | * 获取用户名 9 | * @return 10 | */ 11 | String getUniqueName(); 12 | 13 | /** 14 | * 获取用户ID 15 | * @return 16 | */ 17 | String getId(); 18 | 19 | /** 20 | * 获取名称 21 | * @return 22 | */ 23 | String getName(); 24 | 25 | /** 26 | * 获取地址 27 | * @return 28 | */ 29 | String getAddress(); 30 | } 31 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/service/ResourceAuthorityBiz.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.user.entity.ResourceAuthority; 5 | import com.mvc.user.mapper.ResourceAuthorityMapper; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | @Service 13 | @Transactional(rollbackFor = Exception.class) 14 | public class ResourceAuthorityBiz extends BaseBiz { 15 | } 16 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/util/user/JwtAuthenticationResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.util.user; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | public class JwtAuthenticationResponse implements Serializable { 9 | private static final long serialVersionUID = 1250166508152483573L; 10 | 11 | private final String token; 12 | 13 | public JwtAuthenticationResponse(String token) { 14 | this.token = token; 15 | } 16 | 17 | public String getToken() { 18 | return this.token; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/util/user/JwtUserAuthenticationRequest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.util.user; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @Data 12 | public class JwtUserAuthenticationRequest implements Serializable { 13 | 14 | private static final long serialVersionUID = -8445943548965154778L; 15 | 16 | private String userName; 17 | private String clientId; 18 | private BigInteger userId; 19 | private String address; 20 | } 21 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Filter.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import lombok.*; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Builder(builderClassName = "Builder", toBuilder = true) 10 | @Getter 11 | @Setter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | public class Filter { 16 | private String fromBlock = "0x0"; 17 | private String toBlock = "lastest"; 18 | private String address; 19 | private String topics; 20 | } 21 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/Config.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | import java.util.Date; 7 | 8 | /** 9 | * config 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/10 14:05 13 | */ 14 | @Data 15 | public class Config { 16 | 17 | private BigInteger id; 18 | private String config; 19 | private Integer type; 20 | private Integer switchKey; 21 | private Integer status; 22 | private Date createdAt; 23 | private Date updatedAt; 24 | private Date deletedAt; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/entity/Config.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigInteger; 6 | import java.util.Date; 7 | 8 | /** 9 | * config 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/10 14:05 13 | */ 14 | @Data 15 | public class Config { 16 | 17 | private BigInteger id; 18 | private String config; 19 | private Integer type; 20 | private Integer switchKey; 21 | private Integer status; 22 | private Date createdAt; 23 | private Date updatedAt; 24 | private Date deletedAt; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mvc-center/src/main/java/com/mvc/center/CenterBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.center; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | /** 8 | * ${DESCRIPTION} 9 | * 10 | * @author wanghaobin 11 | * @create 2017-05-25 12:44 12 | */ 13 | @EnableEurekaServer 14 | @SpringBootApplication 15 | public class CenterBootstrap { 16 | public static void main(String[] args) { 17 | SpringApplication.run(CenterBootstrap.class, args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/service/CoinInfoService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.console.entity.CoinInfo; 5 | import com.mvc.console.mapper.CoinInfoMapper; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * ${DESCRIPTION} 11 | * 12 | * @author wanghaobin 13 | * @create 2017-06-08 16:23 14 | */ 15 | @Service 16 | @Transactional(rollbackFor = Exception.class) 17 | public class CoinInfoService extends BaseBiz { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/rest/TransferController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.console.service.ConfigService; 5 | import com.mvc.console.entity.CoinInfo; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | /** 10 | * config controller 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/10 14:07 14 | */ 15 | @Controller 16 | @RequestMapping("transfer") 17 | public class TransferController extends BaseController { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rest/CapitalController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.console.service.CapitalService; 5 | import com.mvc.console.entity.Capital; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * ${DESCRIPTION} 11 | * 12 | * @author wanghaobin 13 | * @create 2017-06-08 11:51 14 | */ 15 | @RestController 16 | @RequestMapping("capital") 17 | public class CapitalController extends BaseController { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/mapper/CapitalMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.Capital; 4 | import com.mvc.user.vo.CapitalVO; 5 | import org.apache.ibatis.annotations.Select; 6 | import tk.mybatis.mapper.common.Mapper; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author qyc 12 | */ 13 | public interface CapitalMapper extends Mapper { 14 | /** 15 | * list 16 | * 17 | * @param capital 18 | * @return 19 | */ 20 | @Select("select * from capital where user_id = #{userId} order by coin_id asc") 21 | List list(Capital capital); 22 | } -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/vo/GroupTree.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.common.vo.TreeNode; 4 | 5 | /** 6 | * @author qyc 7 | * @create 2017-06-17 15:21 8 | */ 9 | public class GroupTree extends TreeNode { 10 | String label; 11 | 12 | public String getLabel() { 13 | return label; 14 | } 15 | 16 | public void setLabel(String label) { 17 | this.label = label; 18 | } 19 | 20 | String name; 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rest/CoinInfoController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.console.service.CoinInfoService; 5 | import com.mvc.console.entity.CoinInfo; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * ${DESCRIPTION} 11 | * 12 | * @author wanghaobin 13 | * @create 2017-06-08 11:51 14 | */ 15 | @RestController 16 | @RequestMapping("coinInfo") 17 | public class CoinInfoController extends BaseController { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/ResourceAuthorityMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.ResourceAuthority; 4 | import org.apache.ibatis.annotations.Param; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public interface ResourceAuthorityMapper extends Mapper { 11 | /** 12 | * deleteByAuthorityIdAndResourceType 13 | * 14 | * @param authorityId 15 | * @param resourceType 16 | */ 17 | void deleteByAuthorityIdAndResourceType(@Param("authorityId") String authorityId, @Param("resourceType") String resourceType); 18 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/ResultCode.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | /** 4 | * 响应码枚举,参考HTTP状态码的语义 5 | * @author 张洁 6 | * @date 2017/11/02 7 | */ 8 | public enum ResultCode { 9 | /**成功*/ 10 | SUCCESS(200), 11 | /**失败*/ 12 | FAILURE(400), 13 | /**未认证*/ 14 | UNAUTHORIZED(401), 15 | /**接口不存在*/ 16 | NOT_FOUND(404), 17 | /**服务器内部错误*/ 18 | INTERNAL_SERVER_ERROR(500), 19 | /**请求参数校验不通过*/ 20 | VALIDATE_ERROR(600), 21 | /**业务异常,如*/ 22 | BUSINESS_ERROR(1000); 23 | 24 | public int code; 25 | 26 | ResultCode(int code) { 27 | this.code = code; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/vo/JwtAuthenticationResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | public class JwtAuthenticationResponse implements Serializable { 12 | private static final long serialVersionUID = 1250166508152483573L; 13 | 14 | private String token; 15 | 16 | public JwtAuthenticationResponse() { 17 | } 18 | 19 | public JwtAuthenticationResponse(String token) { 20 | this.token = token; 21 | } 22 | 23 | public String getToken() { 24 | return this.token; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/vo/JwtAuthenticationResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | public class JwtAuthenticationResponse implements Serializable { 12 | private static final long serialVersionUID = 1250166508152483572L; 13 | 14 | private String token; 15 | 16 | public JwtAuthenticationResponse() { 17 | } 18 | 19 | public JwtAuthenticationResponse(String token) { 20 | this.token = token; 21 | } 22 | 23 | public String getToken() { 24 | return this.token; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/EthTransaction.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import lombok.*; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Builder(builderClassName = "Builder", toBuilder = true) 10 | @Getter 11 | @Setter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | public class EthTransaction { 16 | private String data; 17 | private String from; 18 | private String to; 19 | private long gas; 20 | private long gasPrice; 21 | private long value; 22 | // private long nonce; 23 | } 24 | -------------------------------------------------------------------------------- /mvc-config/src/main/java/com/mvc/config/ConfigServerBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.config; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.cloud.config.server.EnableConfigServer; 6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @EnableAutoConfiguration 12 | @EnableEurekaClient 13 | @EnableConfigServer 14 | public class ConfigServerBootstrap { 15 | public static void main(String[] args) { 16 | SpringApplication.run(ConfigServerBootstrap.class, args); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/service/RefundApplicationService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.console.entity.RefundApplication; 5 | import com.mvc.console.mapper.RefundApplicationMapper; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * ${DESCRIPTION} 11 | * 12 | * @author wanghaobin 13 | * @create 2017-06-08 16:23 14 | */ 15 | @Service 16 | @Transactional(rollbackFor = Exception.class) 17 | public class RefundApplicationService extends BaseBiz { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mvc-sms/src/main/java/com/mvc/sms/config/SmsConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.sms.config; 2 | 3 | import com.yunpian.sdk.YunpianClient; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @Configuration() 12 | public class SmsConfiguration { 13 | 14 | @Value("${yunpian.api.key}") 15 | private String apikey; 16 | 17 | @Bean 18 | public YunpianClient yunpianClient() { 19 | YunpianClient clnt = new YunpianClient(apikey).init(); 20 | return clnt; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/vo/GroupTree.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.common.vo.TreeNode; 4 | 5 | /** 6 | * ${DESCRIPTION} 7 | * 8 | * @author wanghaobin 9 | * @create 2017-06-17 15:21 10 | */ 11 | public class GroupTree extends TreeNode { 12 | String label; 13 | 14 | public String getLabel() { 15 | return label; 16 | } 17 | 18 | public void setLabel(String label) { 19 | this.label = label; 20 | } 21 | 22 | String name; 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/rpc/service/EthernumService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rpc.service; 2 | 3 | import com.mvc.api.vo.log.LogInfo; 4 | import org.springframework.cloud.netflix.feign.FeignClient; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @FeignClient("mvc-etherenum") 12 | public interface EthernumService { 13 | /** 14 | * saveLog 15 | * 16 | * @param info 17 | */ 18 | @RequestMapping(value = "/api/log/save", method = RequestMethod.POST) 19 | public void saveLog(LogInfo info); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/vo/GroupTree.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.vo; 2 | 3 | import com.mvc.common.vo.TreeNode; 4 | 5 | /** 6 | * ${DESCRIPTION} 7 | * 8 | * @author wanghaobin 9 | * @create 2017-06-17 15:21 10 | */ 11 | public class GroupTree extends TreeNode { 12 | String label; 13 | 14 | public String getLabel() { 15 | return label; 16 | } 17 | 18 | public void setLabel(String label) { 19 | this.label = label; 20 | } 21 | 22 | String name; 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/JsonCredentials.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | import org.web3j.crypto.Credentials; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Data 10 | public class JsonCredentials { 11 | 12 | private String publicKey; 13 | private String privateKey; 14 | private String address; 15 | 16 | 17 | public JsonCredentials(Credentials credentials) { 18 | this.address = credentials.getAddress(); 19 | this.privateKey = credentials.getEcKeyPair().getPrivateKey().toString(16); 20 | this.publicKey = credentials.getEcKeyPair().getPublicKey().toString(16); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/TransactionResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Getter 10 | @Setter 11 | public class TransactionResponse { 12 | 13 | private String transactionHash; 14 | private T event; 15 | 16 | TransactionResponse() { 17 | } 18 | 19 | public TransactionResponse(String transactionHash) { 20 | this(transactionHash, null); 21 | } 22 | 23 | public TransactionResponse(String transactionHash, T event) { 24 | this.transactionHash = transactionHash; 25 | this.event = event; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/mapper/ClientMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.mapper; 2 | 3 | import com.mvc.auth.entity.Client; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | public interface ClientMapper extends Mapper { 12 | /** 13 | * selectAllowedClient 14 | * 15 | * @param serviceId 16 | * @return 17 | */ 18 | List selectAllowedClient(String serviceId); 19 | 20 | /** 21 | * selectAuthorityServiceInfo 22 | * 23 | * @param clientId 24 | * @return 25 | */ 26 | List selectAuthorityServiceInfo(int clientId); 27 | } -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/java/com/mvc/gate/feign/ILogService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.feign; 2 | 3 | import com.mvc.api.vo.log.LogInfo; 4 | import org.springframework.cloud.netflix.feign.FeignClient; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | 8 | /** 9 | * ${DESCRIPTION} 10 | * 11 | * @author wanghaobin 12 | * @create 2017-07-01 15:16 13 | */ 14 | @FeignClient("mvc-admin") 15 | public interface ILogService { 16 | /** 17 | * saveLog 18 | * @param info 19 | */ 20 | @RequestMapping(value="/api/log/save",method = RequestMethod.POST) 21 | public void saveLog(LogInfo info); 22 | } 23 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/config/Jobs.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config; 2 | 3 | import com.mvc.console.service.ConfigService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.scheduling.annotation.Scheduled; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author qyc 10 | * transfer token to the super account 11 | */ 12 | @Component 13 | public class Jobs { 14 | 15 | @Autowired 16 | private ConfigService configService; 17 | /** 18 | * update config 19 | */ 20 | @Scheduled(cron = "*/10 * * * * ?") 21 | public void updateConfig() { 22 | configService.updateConfig(); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/mapper/LockRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.dto.LockRecordDTO; 4 | import com.mvc.console.entity.LockRecord; 5 | import com.mvc.console.vo.LockRecordVO; 6 | import org.apache.ibatis.annotations.Select; 7 | import tk.mybatis.mapper.common.Mapper; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | public interface LockRecordMapper extends Mapper { 15 | /** 16 | * list 17 | * 18 | * @param lockRecordDTO 19 | * @return 20 | */ 21 | @Select("select * from lock_record where user_id = #{userId}") 22 | List list(LockRecordDTO lockRecordDTO); 23 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/TransferEventResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class TransferEventResponse { 10 | private String from; 11 | private String to; 12 | private long value; 13 | 14 | public TransferEventResponse() { 15 | } 16 | 17 | public TransferEventResponse( 18 | HumanStandardToken.TransferEventResponse transferEventResponse) { 19 | this.from = transferEventResponse.from.toString(); 20 | this.to = transferEventResponse.to.toString(); 21 | this.value = transferEventResponse.value.getValue().longValueExact(); 22 | } 23 | } -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/entity/JwtAuthenticationRequest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | @Data 11 | public class JwtAuthenticationRequest implements Serializable { 12 | 13 | private static final long serialVersionUID = -8445943548965154778L; 14 | 15 | private String username; 16 | private String password; 17 | private String valiCode; 18 | 19 | public JwtAuthenticationRequest(String username, String password) { 20 | this.username = username; 21 | this.password = password; 22 | } 23 | 24 | public JwtAuthenticationRequest() { 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/KeyConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author ace 9 | * @create 2017/12/17. 10 | */ 11 | @Configuration 12 | @Data 13 | public class KeyConfiguration { 14 | @Value("${jwt.rsa-secret}") 15 | private String userSecret; 16 | @Value("${client.rsa-secret}") 17 | private String serviceSecret; 18 | private byte[] userPubKey; 19 | private byte[] userPriKey; 20 | private byte[] servicePriKey; 21 | private byte[] servicePubKey; 22 | } 23 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/config/Jobs.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config; 2 | 3 | import com.mvc.user.service.UserService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.scheduling.annotation.Scheduled; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author qyc 10 | * transfer token to the super account 11 | */ 12 | @Component 13 | public class Jobs { 14 | 15 | @Autowired 16 | private UserService userService; 17 | 18 | /** 19 | * update user if the eth address is null 20 | */ 21 | @Scheduled(cron = "0 */5 * * * ?") 22 | public void updateAddress() { 23 | userService.updateAddress(); 24 | } 25 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/ApprovalEventResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | @Data 9 | public class ApprovalEventResponse { 10 | private String owner; 11 | private String spender; 12 | private long value; 13 | 14 | public ApprovalEventResponse() { 15 | } 16 | 17 | public ApprovalEventResponse( 18 | HumanStandardToken.ApprovalEventResponse approvalEventResponse) { 19 | this.owner = approvalEventResponse.owner.toString(); 20 | this.spender = approvalEventResponse.spender.toString(); 21 | this.value = approvalEventResponse.value.getValue().longValueExact(); 22 | } 23 | } -------------------------------------------------------------------------------- /mvc-gate/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | com.mvc 7 | mvc-wallet 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | mvc-gate 13 | pom 14 | 15 | mvc-gate-ratelimit 16 | mvc-gate-server 17 | 18 | 19 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.User; 4 | import org.apache.ibatis.annotations.Param; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | public interface UserMapper extends Mapper { 13 | /** 14 | * selectMemberByGroupId 15 | * 16 | * @param groupId 17 | * @return 18 | */ 19 | List selectMemberByGroupId(@Param("groupId") int groupId); 20 | 21 | /** 22 | * selectLeaderByGroupId 23 | * 24 | * @param groupId 25 | * @return 26 | */ 27 | List selectLeaderByGroupId(@Param("groupId") int groupId); 28 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Method.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import lombok.*; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @Builder(builderClassName = "Builder", toBuilder = true) 12 | @Getter 13 | @Setter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @JsonIgnoreProperties(ignoreUnknown = true) 17 | public class Method { 18 | @NotNull 19 | private Object[] args; 20 | private String name; 21 | 22 | public Object[] getArgs() { 23 | if (args != null) { 24 | return args; 25 | } 26 | return new Object[0]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rest/ConfigController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.rest.BaseController; 4 | import com.mvc.console.service.ConfigService; 5 | import com.mvc.console.entity.CoinInfo; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | 10 | /** 11 | * config controller 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/10 14:07 15 | */ 16 | @Controller 17 | @RequestMapping("config") 18 | public class ConfigController extends BaseController { 19 | 20 | @Autowired 21 | private ConfigService configService; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/vo/LockRecordVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.vo; 2 | 3 | import com.mvc.console.entity.LockRecord; 4 | import com.mvc.console.util.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * LockRecordVO 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/11 19:54 12 | */ 13 | @Data 14 | public class LockRecordVO extends LockRecord { 15 | 16 | public String type(){ 17 | return CoinUtil.getUnit(super.getCoinId()); 18 | } 19 | 20 | public Double getQuantityStr(){ 21 | return CoinUtil.wei2Value( super.getCoinId(), super.getQuantity()); 22 | } 23 | 24 | public Double getInterestStr(){ 25 | return CoinUtil.wei2Value( super.getCoinId(), super.getInterest()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/entity/Capital.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.math.BigInteger; 8 | import java.util.Date; 9 | 10 | /** 11 | * capital 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/9 16:19 15 | */ 16 | @Data 17 | @Table(name = "capital") 18 | public class Capital { 19 | 20 | @Id 21 | private BigInteger id; 22 | private BigInteger userId; 23 | private BigInteger balance; 24 | private BigInteger locked; 25 | private Integer status; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private BigInteger coinId; 29 | private BigInteger interest; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/entity/CoinInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * coin info 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:28 14 | */ 15 | @Data 16 | public class CoinInfo { 17 | @Id 18 | private BigInteger id; 19 | private String name; 20 | private String abbr; 21 | private Integer digit; 22 | private BigInteger ratio; 23 | private Integer status; 24 | private String icon; 25 | private String address; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private Date deletedAt; 29 | private String nameEn; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/dto/WithdrawDTO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NonNull; 5 | import org.hibernate.validator.constraints.Length; 6 | 7 | import javax.validation.constraints.Min; 8 | import java.math.BigDecimal; 9 | import java.math.BigInteger; 10 | 11 | /** 12 | * WithdrawDTO 13 | * 14 | * @author qiyichen 15 | * @create 2018/1/10 16:10 16 | */ 17 | @Data 18 | public class WithdrawDTO { 19 | 20 | private BigInteger userId; 21 | @Length(min = 42, max = 42, message = "地址格式错误") 22 | @NonNull 23 | private String address; 24 | private String password; 25 | private String valiCode; 26 | @NonNull 27 | private BigDecimal value; 28 | private String type; 29 | } 30 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/Capital.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.math.BigInteger; 8 | import java.util.Date; 9 | 10 | /** 11 | * capital 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/9 16:19 15 | */ 16 | @Data 17 | @Table(name = "capital") 18 | public class Capital { 19 | 20 | @Id 21 | private BigInteger id; 22 | private BigInteger userId; 23 | private BigInteger balance; 24 | private BigInteger locked; 25 | private Integer status; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private BigInteger coinId; 29 | private BigInteger interest; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/CoinInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * coin info 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:28 14 | */ 15 | @Data 16 | public class CoinInfo { 17 | @Id 18 | private BigInteger id; 19 | private String name; 20 | private String abbr; 21 | private Integer digit; 22 | private BigInteger ratio; 23 | private Integer status; 24 | private String icon; 25 | private String address; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private Date deletedAt; 29 | private String nameEn; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/LockRecord.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * lock_record 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:33 14 | */ 15 | @Data 16 | public class LockRecord { 17 | @Id 18 | private BigInteger id; 19 | private BigInteger userId; 20 | private BigInteger quantity; 21 | private Integer status; 22 | private Date createdAt; 23 | private String orderId; 24 | private BigInteger coinId; 25 | private BigInteger interest; 26 | private Float interestRate; 27 | private Integer month; 28 | private Date updatedAt; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Capital.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.math.BigInteger; 8 | import java.util.Date; 9 | 10 | /** 11 | * capital 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/9 16:19 15 | */ 16 | @Data 17 | @Table(name = "capital") 18 | public class Capital { 19 | 20 | @Id 21 | private BigInteger id; 22 | private BigInteger userId; 23 | private BigInteger balance; 24 | private BigInteger locked; 25 | private Integer status; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private BigInteger coinId; 29 | private BigInteger interest; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/CoinInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * coin info 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:28 14 | */ 15 | @Data 16 | public class CoinInfo { 17 | @Id 18 | private BigInteger id; 19 | private String name; 20 | private String abbr; 21 | private Integer digit; 22 | private BigInteger ratio; 23 | private Integer status; 24 | private String icon; 25 | private String address; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private Date deletedAt; 29 | private String nameEn; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/LockRecord.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * lock_record 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:33 14 | */ 15 | @Data 16 | public class LockRecord { 17 | @Id 18 | private BigInteger id; 19 | private BigInteger userId; 20 | private BigInteger quantity; 21 | private Integer status; 22 | private Date createdAt; 23 | private String orderId; 24 | private BigInteger coinId; 25 | private BigInteger interest; 26 | private Float interestRate; 27 | private Integer month; 28 | private Date updatedAt; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/entity/CoinInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * coin info 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:28 14 | */ 15 | @Data 16 | public class CoinInfo { 17 | @Id 18 | private BigInteger id; 19 | private String name; 20 | private String abbr; 21 | private Integer digit; 22 | private BigInteger ratio; 23 | private Integer status; 24 | private String icon; 25 | private String address; 26 | private Date createdAt; 27 | private Date updatedAt; 28 | private Date deletedAt; 29 | private String nameEn; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-auth/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | mvc-wallet 7 | com.mvc 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | mvc-auth 13 | pom 14 | 15 | 16 | mvc-auth-client 17 | mvc-auth-server 18 | mvc-auth-common 19 | 20 | 21 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/LockRecordVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.mvc.ethereum.model.LockRecord; 4 | import com.mvc.ethereum.utils.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * LockRecordVO 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/11 19:54 12 | */ 13 | @Data 14 | public class LockRecordVO extends LockRecord { 15 | 16 | public String type(){ 17 | return CoinUtil.getUnit(super.getCoinId()); 18 | } 19 | 20 | public Double getQuantityStr(){ 21 | return CoinUtil.wei2Value( super.getCoinId(), super.getQuantity()); 22 | } 23 | 24 | public Double getInterestStr(){ 25 | return CoinUtil.wei2Value( super.getCoinId(), super.getInterest()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/utils/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | public class FileUtil { 12 | 13 | public static String readFile(InputStream inputStream) throws IOException { 14 | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); 15 | StringBuffer buffer = new StringBuffer(); 16 | String line = null; 17 | while ((line = bufferedReader.readLine()) != null) { 18 | buffer.append(line); 19 | } 20 | inputStream.close(); 21 | return buffer.toString(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/BaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class BaseResponse { 7 | private int status = 200; 8 | private String message; 9 | 10 | public BaseResponse(int status, String message) { 11 | this.status = status; 12 | this.message = message; 13 | } 14 | 15 | public BaseResponse() { 16 | } 17 | 18 | public String getMessage() { 19 | return message; 20 | } 21 | 22 | public void setMessage(String message) { 23 | this.message = message; 24 | } 25 | 26 | public int getStatus() { 27 | return status; 28 | } 29 | 30 | public void setStatus(int status) { 31 | this.status = status; 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/service/GateLogBiz.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.user.entity.GateLog; 5 | import com.mvc.user.mapper.GateLogMapper; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * @author qyc 11 | * @create 2017-07-01 14:36 12 | */ 13 | @Service 14 | @Transactional(rollbackFor = Exception.class) 15 | public class GateLogBiz extends BaseBiz { 16 | 17 | @Override 18 | public void insert(GateLog entity) { 19 | mapper.insert(entity); 20 | } 21 | 22 | @Override 23 | public void insertSelective(GateLog entity) { 24 | mapper.insertSelective(entity); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/DepositeCount.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.mvc.ethereum.utils.CoinUtil; 4 | import lombok.Data; 5 | 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * @author qiyichen 10 | * @create 2018/1/16 11:27 11 | */ 12 | @Data 13 | public class DepositeCount { 14 | 15 | private BigInteger actualQuantity; 16 | private BigInteger quantity; 17 | private Integer num; 18 | private BigInteger coinId; 19 | private Double actualQuantityStr; 20 | private Double quantityStr; 21 | 22 | public Double getActualQuantityStr() { 23 | return CoinUtil.wei2Value(coinId, actualQuantity); 24 | } 25 | 26 | public Double getQuantityStr() { 27 | return CoinUtil.wei2Value(coinId, quantity); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/vo/UserVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.user.entity.User; 4 | import lombok.Data; 5 | 6 | import javax.persistence.ManyToOne; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Pattern; 9 | import java.math.BigInteger; 10 | import java.util.Date; 11 | import java.util.List; 12 | 13 | /** 14 | * UserVO 15 | * 16 | * @author qiyichen 17 | * @create 2018/1/12 16:26 18 | */ 19 | @Data 20 | public class UserVO { 21 | 22 | private BigInteger id; 23 | 24 | private String cellphone; 25 | 26 | private String addressEth; 27 | 28 | private Integer status; 29 | 30 | private Date createdAt; 31 | 32 | private Date updatedAt; 33 | 34 | private Date deletedAt; 35 | 36 | private List list; 37 | } 38 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/ObjectRestResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class ObjectRestResponse extends BaseResponse { 7 | 8 | T data; 9 | boolean rel; 10 | 11 | public boolean isRel() { 12 | return rel; 13 | } 14 | 15 | public void setRel(boolean rel) { 16 | this.rel = rel; 17 | } 18 | 19 | 20 | public ObjectRestResponse rel(boolean rel) { 21 | this.setRel(rel); 22 | return this; 23 | } 24 | 25 | 26 | public ObjectRestResponse data(T data) { 27 | this.setData(data); 28 | return this; 29 | } 30 | 31 | public T getData() { 32 | return data; 33 | } 34 | 35 | public void setData(T data) { 36 | this.data = data; 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/Transaction.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * transaction 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:35 14 | */ 15 | @Data 16 | public class Transaction { 17 | @Id 18 | private BigInteger id; 19 | private BigInteger userId; 20 | private Integer type; 21 | private Integer status; 22 | private String txHash; 23 | private BigInteger quantity; 24 | private BigInteger actualQuantity; 25 | private Date createdAt; 26 | private Date updatedAt; 27 | private BigInteger coinId; 28 | private String orderId; 29 | private String toAddress; 30 | private String fromAddress; 31 | } 32 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/Transaction.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * transaction 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:35 14 | */ 15 | @Data 16 | public class Transaction { 17 | @Id 18 | private BigInteger id; 19 | private BigInteger userId; 20 | private Integer type; 21 | private Integer status; 22 | private String txHash; 23 | private BigInteger quantity; 24 | private BigInteger actualQuantity; 25 | private Date createdAt; 26 | private Date updatedAt; 27 | private BigInteger coinId; 28 | private String orderId; 29 | private String toAddress; 30 | private String fromAddress; 31 | } 32 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/entity/Transaction.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * transaction 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/9 16:35 14 | */ 15 | @Data 16 | public class Transaction { 17 | @Id 18 | private BigInteger id; 19 | private BigInteger userId; 20 | private Integer type; 21 | private Integer status; 22 | private String txHash; 23 | private BigInteger quantity; 24 | private BigInteger actualQuantity; 25 | private Date createdAt; 26 | private Date updatedAt; 27 | private BigInteger coinId; 28 | private String orderId; 29 | private String toAddress; 30 | private String fromAddress; 31 | } 32 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/java/com/mvc/gate/feign/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.feign; 2 | 3 | import com.mvc.api.vo.authority.PermissionInfo; 4 | import feign.Param; 5 | import feign.RequestLine; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * ${DESCRIPTION} 12 | * 13 | * @author wanghaobin 14 | * @create 2017-06-21 8:11 15 | */ 16 | public interface IUserService { 17 | /** 18 | * getPermissionByUsername 19 | * @param username 20 | * @return 21 | */ 22 | @RequestLine(value = "GET /api/user/un/{username}/permissions") 23 | public List getPermissionByUsername(@Param("username") String username); 24 | 25 | /** 26 | * getAllPermissionInfo 27 | * @return 28 | */ 29 | @RequestLine(value = "GET /api/permissions") 30 | List getAllPermissionInfo(); 31 | } 32 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/WithdrawCount.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.mvc.ethereum.utils.CoinUtil; 4 | import lombok.Data; 5 | 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * WithdrawCount 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/16 11:26 13 | */ 14 | @Data 15 | public class WithdrawCount { 16 | 17 | private BigInteger actualQuantity; 18 | private BigInteger quantity; 19 | private Integer num; 20 | private BigInteger coinId; 21 | private Double actualQuantityStr; 22 | private Double quantityStr; 23 | 24 | 25 | public Double getActualQuantityStr() { 26 | return CoinUtil.wei2Value(coinId, actualQuantity); 27 | } 28 | 29 | public Double getQuantityStr() { 30 | return CoinUtil.wei2Value(coinId, quantity); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/ClientConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | @Configuration 10 | public class ClientConfiguration { 11 | @Value("${client.id}") 12 | private String clientId; 13 | @Value("${client.secret}") 14 | private String clientSecret; 15 | @Value("${client.token-header}") 16 | private String clientTokenHeader; 17 | 18 | public String getClientTokenHeader() { 19 | return clientTokenHeader; 20 | } 21 | 22 | public String getClientSecret() { 23 | return clientSecret; 24 | } 25 | 26 | public String getClientId() { 27 | return clientId; 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/vo/GroupUsers.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.user.entity.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class GroupUsers { 11 | List members; 12 | List leaders; 13 | 14 | public GroupUsers() { 15 | } 16 | 17 | public GroupUsers(List members, List leaders) { 18 | this.members = members; 19 | this.leaders = leaders; 20 | } 21 | 22 | public List getMembers() { 23 | return members; 24 | } 25 | 26 | public void setMembers(List members) { 27 | this.members = members; 28 | } 29 | 30 | public List getLeaders() { 31 | return leaders; 32 | } 33 | 34 | public void setLeaders(List leaders) { 35 | this.leaders = leaders; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /mysql-backup/backup.sh: -------------------------------------------------------------------------------- 1 | 2 | # 1.Backup the current sql data. 3 | mysqldump -uroot -p mvc-user > /opt/mvc-user.sql 4 | 5 | # 2.Edit mysql config. 6 | vi /etc/mysql/mysql.conf.d/mysqld.cnf 7 | 8 | server-id = 8 9 | log_bin = /var/lib/mysql/mysql-bin 10 | binlog_do_db = mvc-user 11 | 12 | service mysql restart 13 | 14 | # 3.SSH bypass password login. 15 | # on backup server allow app server's access. 16 | # on app server 17 | ssh-keygen -t rsa 18 | # input 19 | /root/.ssh/id_rsa 20 | # ignore password, just enter. 21 | # on backup server 22 | vi /root/.ssh/authorized_keys 23 | # on app server paste vi /root/.ssh/id_rsa.pub 24 | 25 | # 4.Send initial backup file to backup server. 26 | # on backup server 27 | mkdir -p /opt/mysql-backup/lock-process 28 | 29 | # 5.Java development to make app server to send binlog files to backup server daily. -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/vo/GroupUsers.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.user.entity.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class GroupUsers { 11 | List members; 12 | List leaders; 13 | 14 | public GroupUsers() { 15 | } 16 | 17 | public GroupUsers(List members, List leaders) { 18 | this.members = members; 19 | this.leaders = leaders; 20 | } 21 | 22 | public List getMembers() { 23 | return members; 24 | } 25 | 26 | public void setMembers(List members) { 27 | this.members = members; 28 | } 29 | 30 | public List getLeaders() { 31 | return leaders; 32 | } 33 | 34 | public void setLeaders(List leaders) { 35 | this.leaders = leaders; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/rpc/LogRest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc; 2 | 3 | import com.mvc.api.vo.log.LogInfo; 4 | import com.mvc.user.entity.GateLog; 5 | import com.mvc.user.service.GateLogBiz; 6 | import org.springframework.beans.BeanUtils; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | * @author qyc 12 | * @create 2017-07-01 14:39 13 | */ 14 | @RequestMapping("api") 15 | @RestController 16 | public class LogRest { 17 | @Autowired 18 | private GateLogBiz gateLogBiz; 19 | 20 | @RequestMapping(value = "/log/save", method = RequestMethod.POST) 21 | public @ResponseBody 22 | void saveLog(@RequestBody LogInfo info) { 23 | GateLog log = new GateLog(); 24 | BeanUtils.copyProperties(info, log); 25 | gateLogBiz.insertSelective(log); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-common/src/main/java/com/mvc/auth/common/event/AuthRemoteEvent.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.common.event; 2 | 3 | import lombok.Data; 4 | import org.springframework.cloud.bus.event.RemoteApplicationEvent; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author ace 10 | * @create 2017/11/4. 11 | */ 12 | @Data 13 | public class AuthRemoteEvent extends RemoteApplicationEvent { 14 | private List allowedClient; 15 | 16 | public AuthRemoteEvent() { 17 | } 18 | 19 | public AuthRemoteEvent(Object source, String originService, String destinationService, List allowedClient) { 20 | // source is the object that is publishing the event 21 | // originService is the unique context ID of the publisher 22 | super(source, originService, destinationService); 23 | this.allowedClient = allowedClient; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/RefundApplication.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Table; 6 | import java.math.BigInteger; 7 | import java.util.Date; 8 | 9 | /** 10 | * refund_application 11 | * 12 | * @author qiyichen 13 | * @create 2018/1/10 12:12 14 | */ 15 | @Data 16 | @Table(name = "refund_application") 17 | public class RefundApplication { 18 | 19 | private BigInteger id; 20 | private BigInteger userId; 21 | private String realName; 22 | private String idCardNo; 23 | private BigInteger refundQuantity; 24 | private String photoPath1; 25 | private String photoPath2; 26 | private String photoPath3; 27 | private String photoPath4; 28 | private String comment; 29 | private Integer status; 30 | private Date createdAt; 31 | private String cellphone; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rpc/service/SmsService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rpc.service; 2 | 3 | import com.mvc.console.dto.MobileValiDTO; 4 | import org.springframework.cloud.netflix.feign.FeignClient; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | /** 11 | * sms remote rpc 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/8 21:48 15 | */ 16 | @FeignClient("mvc-sms") 17 | public interface SmsService { 18 | /** 19 | * checkSms 20 | * @param mobileValiDTO 21 | * @return 22 | */ 23 | @RequestMapping(value="/sms/code/validate",method = RequestMethod.POST) 24 | ResponseEntity checkSms(@RequestBody MobileValiDTO mobileValiDTO); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mvc-sms/src/main/java/com/mvc/sms/SmsBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.sms; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.scheduling.annotation.EnableAsync; 9 | import org.springframework.scheduling.annotation.EnableScheduling; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | @EnableEurekaClient 15 | @EnableCircuitBreaker 16 | @SpringBootApplication 17 | @EnableScheduling 18 | @EnableAsync 19 | @ComponentScan 20 | public class SmsBootstrap { 21 | public static void main(String[] args) { 22 | new SpringApplicationBuilder(SmsBootstrap.class).web(true).run(args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/rpc/service/SmsService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc.service; 2 | 3 | import com.mvc.user.dto.MobileValiDTO; 4 | import com.mvc.api.vo.log.LogInfo; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | 11 | /** 12 | * sms remote rpc 13 | * 14 | * @author qiyichen 15 | * @create 2018/1/8 21:48 16 | */ 17 | @FeignClient("mvc-sms") 18 | public interface SmsService { 19 | /** 20 | * checkSms 21 | * @param mobileValiDTO 22 | * @return 23 | */ 24 | @RequestMapping(value="/sms/code/validate",method = RequestMethod.POST) 25 | ResponseEntity checkSms(@RequestBody MobileValiDTO mobileValiDTO); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/rpc/service/EthernumRest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc.service; 2 | 3 | import com.mvc.api.vo.user.NewAccountDTO; 4 | import com.mvc.common.msg.Result; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | /** 11 | * ${DESCRIPTION} 12 | * 13 | * @author wanghaobin 14 | * @create 2017-06-21 8:15 15 | */ 16 | @FeignClient("mvc-etherenum") 17 | public interface EthernumRest { 18 | 19 | /** 20 | * personal_newAccount 21 | * 22 | * @param newAccountDTO 23 | * @return 24 | */ 25 | @RequestMapping(value = "ethereum/personal_newAccount", method = RequestMethod.POST) 26 | Result personal_newAccount(@RequestBody NewAccountDTO newAccountDTO); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /mvc-user/src/main/resources/mapper/GateLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/entity/WithdrawConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.entity; 2 | 3 | import com.mvc.console.util.CoinUtil; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | import java.math.BigInteger; 8 | import java.math.RoundingMode; 9 | 10 | /** 11 | * withdraw 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/13 6:34 15 | */ 16 | @Data 17 | public class WithdrawConfig { 18 | 19 | private Integer switchKey; 20 | private String type; 21 | private BigDecimal min; 22 | private BigDecimal max; 23 | private Float poundage; 24 | 25 | public BigInteger getPoundageValue(BigDecimal value, String type) { 26 | BigDecimal ratioInt = new BigDecimal(poundage).setScale(5, RoundingMode.HALF_DOWN); 27 | value.setScale(5, RoundingMode.HALF_DOWN); 28 | BigInteger result = CoinUtil.Value2wei(value.multiply(ratioInt), type); 29 | return result; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | discovery: 5 | service-id: mvc-config 6 | enabled: true 7 | label: master # git 分支 8 | name: gate 9 | profile: dev 10 | 11 | eureka: 12 | instance: 13 | statusPageUrlPath: /info 14 | healthCheckUrlPath: /health 15 | # docker 部署开启 16 | # prefer-ip-address: true 17 | # ip-address: 127.0.0.1 18 | client: 19 | serviceUrl: 20 | # defaultZone: http://localhost:8761/eureka/ 21 | # docker 部署开启 22 | defaultZone: http://${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka/ 23 | 24 | #请求和响应GZIP压缩支持 25 | feign: 26 | compression: 27 | request: 28 | enabled: true 29 | mime-types: text/xml,application/xml,application/json 30 | min-request-size: 2048 31 | response: 32 | enabled: true 33 | 34 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.service; 2 | 3 | import com.mvc.common.biz.BaseBiz; 4 | import com.mvc.console.entity.Config; 5 | import com.mvc.console.mapper.ConfigMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | /** 11 | * ${DESCRIPTION} 12 | * 13 | * @author wanghaobin 14 | * @create 2017-06-08 16:23 15 | */ 16 | @Service 17 | @Transactional(rollbackFor = Exception.class) 18 | public class ConfigService extends BaseBiz { 19 | 20 | @Autowired 21 | private ConfigMapper configMapper; 22 | 23 | public void insertOrUpdate(Config config) { 24 | Config conf = new Config(); 25 | conf.setType(config.getType()); 26 | configMapper.delete(conf); 27 | configMapper.insert(config); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/vo/TreeNode.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.vo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public class TreeNode { 10 | protected int id; 11 | protected int parentId; 12 | 13 | public List getChildren() { 14 | return children; 15 | } 16 | 17 | public void setChildren(List children) { 18 | this.children = children; 19 | } 20 | 21 | List children = new ArrayList(); 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public int getParentId() { 32 | return parentId; 33 | } 34 | 35 | public void setParentId(int parentId) { 36 | this.parentId = parentId; 37 | } 38 | 39 | public void add(TreeNode node) { 40 | children.add(node); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /mvc-admin/src/main/resources/mapper/GateLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/vo/TransactionVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.vo; 2 | 3 | import com.mvc.console.entity.Transaction; 4 | import com.mvc.console.util.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * Capital vo 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/9 17:29 12 | */ 13 | @Data 14 | public class TransactionVO extends Transaction { 15 | 16 | public Double getQuantityStr(){ 17 | return CoinUtil.wei2Value(super.getCoinId(), super.getQuantity()); 18 | } 19 | 20 | public Double getActualQuantityStr(){ 21 | return CoinUtil.wei2Value(super.getCoinId(), super.getActualQuantity()); 22 | } 23 | 24 | public String getUnit(){ 25 | return CoinUtil.getUnit(super.getCoinId()); 26 | } 27 | 28 | public String getName(){ 29 | return CoinUtil.getName(super.getCoinId()); 30 | } 31 | 32 | public String getNameEn(){ 33 | return CoinUtil.getNameEn(super.getCoinId()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/config/druid/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config.druid; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebServlet; 6 | 7 | /** 8 | * ${DESCRIPTION} 9 | * 10 | * @author wanghaobin 11 | * @create 2017-06-20 21:34 12 | */ 13 | @SuppressWarnings("serial") 14 | @WebServlet(urlPatterns = "/druid/*", 15 | initParams={ 16 | // @WebInitParam(name="allow",value="127.0.0.1,192.168.1.188"),// IP白名单 (没有配置或者为空,则允许所有访问) 17 | // @WebInitParam(name="deny",value="192.168.1.111"),// IP黑名单 (存在共同时,deny优先于allow) 18 | // @WebInitParam(name="loginUsername",value="user"),// 用户名 19 | // @WebInitParam(name="loginPassword",value="123456"),// 密码 20 | // @WebInitParam(name="resetEnable",value="false")// 禁用HTML页面上的“Reset All”功能 21 | }) 22 | public class DruidStatViewServlet extends StatViewServlet { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/AuthBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth; 2 | 3 | 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan; 9 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 10 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 11 | 12 | /** 13 | * @author qyc 14 | */ 15 | @SpringBootApplication 16 | @EnableEurekaClient 17 | @EnableFeignClients 18 | @MapperScan("com.mvc.auth.mapper") 19 | @RemoteApplicationEventScan(basePackages = "com.mvc.auth.common.event") 20 | @EnableAutoConfiguration 21 | public class AuthBootstrap { 22 | public static void main(String[] args) { 23 | SpringApplication.run(AuthBootstrap.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/rpc/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.mvc.user.entity.JwtAuthenticationRequest; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | 11 | 12 | /** 13 | * @author qyc 14 | * @create 2017-06-21 8:11 15 | */ 16 | @FeignClient("mvc-auth") 17 | public interface AuthService { 18 | /** 19 | * createAuthenticationToken 20 | * 21 | * @param authenticationRequest 22 | * @return 23 | */ 24 | @RequestMapping(value = "jwt/token", method = RequestMethod.POST) 25 | public ResponseEntity createAuthenticationToken( 26 | @RequestBody JwtAuthenticationRequest authenticationRequest); 27 | } 28 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/config/UserAuthConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class UserAuthConfig { 11 | 12 | @Value("${auth.user.token-header}") 13 | private String tokenHeader; 14 | 15 | private byte[] pubKeyByte; 16 | 17 | public String getTokenHeader() { 18 | return tokenHeader; 19 | } 20 | 21 | public void setTokenHeader(String tokenHeader) { 22 | this.tokenHeader = tokenHeader; 23 | } 24 | 25 | public String getToken(HttpServletRequest request) { 26 | return request.getHeader(this.getTokenHeader()); 27 | } 28 | 29 | public byte[] getPubKeyByte() { 30 | return pubKeyByte; 31 | } 32 | 33 | public void setPubKeyByte(byte[] pubKeyByte) { 34 | this.pubKeyByte = pubKeyByte; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-client/src/main/java/com/mvc/auth/client/configuration/AutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.client.configuration; 2 | 3 | import com.mvc.auth.client.config.ServiceAuthConfig; 4 | import com.mvc.auth.client.config.UserAuthConfig; 5 | import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | * @author qyc 12 | */ 13 | @Configuration 14 | @ComponentScan({"com.mvc.auth.client", "com.mvc.auth.common.event"}) 15 | @RemoteApplicationEventScan(basePackages = "com.mvc.auth.common.event") 16 | public class AutoConfiguration { 17 | @Bean 18 | ServiceAuthConfig getServiceAuthConfig() { 19 | return new ServiceAuthConfig(); 20 | } 21 | 22 | @Bean 23 | UserAuthConfig getUserAuthConfig() { 24 | return new UserAuthConfig(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/config/druid/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config.druid; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebServlet; 6 | 7 | /** 8 | * ${DESCRIPTION} 9 | * 10 | * @author wanghaobin 11 | * @create 2017-06-20 21:34 12 | */ 13 | @SuppressWarnings("serial") 14 | @WebServlet(urlPatterns = "/druid/*", 15 | initParams={ 16 | // @WebInitParam(name="allow",value="127.0.0.1,192.168.1.188"),// IP白名单 (没有配置或者为空,则允许所有访问) 17 | // @WebInitParam(name="deny",value="192.168.1.111"),// IP黑名单 (存在共同时,deny优先于allow) 18 | // @WebInitParam(name="loginUsername",value="user"),// 用户名 19 | // @WebInitParam(name="loginPassword",value="123456"),// 密码 20 | // @WebInitParam(name="resetEnable",value="false")// 禁用HTML页面上的“Reset All”功能 21 | }) 22 | public class DruidStatViewServlet extends StatViewServlet { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/config/druid/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config.druid; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebServlet; 6 | 7 | /** 8 | * ${DESCRIPTION} 9 | * 10 | * @author wanghaobin 11 | * @create 2017-06-20 21:34 12 | */ 13 | @SuppressWarnings("serial") 14 | @WebServlet(urlPatterns = "/druid/*", 15 | initParams={ 16 | // @WebInitParam(name="allow",value="127.0.0.1,192.168.1.188"),// IP白名单 (没有配置或者为空,则允许所有访问) 17 | // @WebInitParam(name="deny",value="192.168.1.111"),// IP黑名单 (存在共同时,deny优先于allow) 18 | // @WebInitParam(name="loginUsername",value="user"),// 用户名 19 | // @WebInitParam(name="loginPassword",value="123456"),// 密码 20 | // @WebInitParam(name="resetEnable",value="false")// 禁用HTML页面上的“Reset All”功能 21 | }) 22 | public class DruidStatViewServlet extends StatViewServlet { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/AdminBalanceVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.mvc.ethereum.utils.CoinUtil; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigInteger; 10 | 11 | /** 12 | * AdminBalanceVO 13 | * 14 | * @author qiyichen 15 | * @create 2018/1/15 17:20 16 | */ 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | public class AdminBalanceVO { 21 | 22 | private BigInteger balance; 23 | private WithdrawCount withdraw; 24 | private DepositeCount deposite; 25 | private LockCount lock; 26 | private BigInteger coinId; 27 | private BigInteger otherBalance; 28 | 29 | public Double getBalanceStr() { 30 | return CoinUtil.wei2Value(coinId, balance); 31 | } 32 | 33 | public Double getOtherBalanceStr() { 34 | return CoinUtil.wei2Value(coinId, otherBalance); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/TransactionVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.mvc.ethereum.model.Transaction; 4 | import com.mvc.ethereum.utils.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * TransactionVO 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/15 14:33 12 | */ 13 | @Data 14 | public class TransactionVO extends Transaction { 15 | 16 | public Double getQuantityStr(){ 17 | return CoinUtil.wei2Value(super.getCoinId(), super.getQuantity()); 18 | } 19 | 20 | public Double getActualQuantityStr(){ 21 | return CoinUtil.wei2Value(super.getCoinId(), super.getActualQuantity()); 22 | } 23 | 24 | public String getUnit(){ 25 | return CoinUtil.getUnit(super.getCoinId()); 26 | } 27 | 28 | public String getName(){ 29 | return CoinUtil.getName(super.getCoinId()); 30 | } 31 | 32 | public String getNameEn(){ 33 | return CoinUtil.getNameEn(super.getCoinId()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/util/ClientUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.util; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | public class ClientUtil { 9 | 10 | private final static String UNKNOWN = "unknown"; 11 | 12 | /** 13 | * 获取客户端真实ip 14 | * 15 | * @param request 16 | * @return 17 | */ 18 | public static String getClientIp(HttpServletRequest request) { 19 | String ip = request.getHeader("x-forwarded-for"); 20 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 21 | ip = request.getHeader("Proxy-Client-IP"); 22 | } 23 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 24 | ip = request.getHeader("WL-Proxy-Client-IP"); 25 | } 26 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 27 | ip = request.getRemoteAddr(); 28 | } 29 | return ip; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/feign/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.feign; 2 | 3 | import com.mvc.api.vo.user.UserInfo; 4 | import com.mvc.auth.configuration.FeignConfiguration; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestMethod; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | 10 | 11 | /** 12 | * ${DESCRIPTION} 13 | * 14 | * @author wanghaobin 15 | * @create 2017-06-21 8:11 16 | */ 17 | @FeignClient(value = "mvc-admin", configuration = FeignConfiguration.class) 18 | public interface IUserService { 19 | /** 20 | * validate 21 | * 22 | * @param username 23 | * @param password 24 | * @return 25 | */ 26 | @RequestMapping(value = "/api/user/validate", method = RequestMethod.POST) 27 | public UserInfo validate(@RequestParam("username") String username, @RequestParam("password") String password); 28 | } 29 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/util/user/JwtAuthenticationRequest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.util.user; 2 | 3 | import java.io.Serializable; 4 | /** 5 | * @author qyc 6 | */ 7 | public class JwtAuthenticationRequest implements Serializable { 8 | 9 | private static final long serialVersionUID = -8445943548965154778L; 10 | 11 | private String username; 12 | private String password; 13 | 14 | 15 | public JwtAuthenticationRequest(String username, String password) { 16 | this.username = username; 17 | this.password = password; 18 | } 19 | 20 | public JwtAuthenticationRequest() { 21 | } 22 | 23 | public String getPassword() { 24 | return password; 25 | } 26 | 27 | public void setPassword(String password) { 28 | this.password = password; 29 | } 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) { 36 | this.username = username; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/config/druid/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config.druid; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebInitParam; 6 | import javax.servlet.annotation.WebServlet; 7 | 8 | /** 9 | * ${DESCRIPTION} 10 | * 11 | * @author wanghaobin 12 | * @create 2017-06-20 21:34 13 | */ 14 | @SuppressWarnings("serial") 15 | @WebServlet(urlPatterns = "/druid/*", 16 | initParams={ 17 | // @WebInitParam(name="allow",value="127.0.0.1,192.168.1.188"),// IP白名单 (没有配置或者为空,则允许所有访问) 18 | // @WebInitParam(name="deny",value="192.168.1.111"),// IP黑名单 (存在共同时,deny优先于allow) 19 | // @WebInitParam(name="loginUsername",value="user"),// 用户名 20 | // @WebInitParam(name="loginPassword",value="123456"),// 密码 21 | // @WebInitParam(name="resetEnable",value="false")// 禁用HTML页面上的“Reset All”功能 22 | }) 23 | public class DruidStatViewServlet extends StatViewServlet { 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.Menu; 4 | import org.apache.ibatis.annotations.Param; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | public interface MenuMapper extends Mapper { 13 | /** 14 | * selectMenuByAuthorityId 15 | * 16 | * @param authorityId 17 | * @param authorityType 18 | * @return 19 | */ 20 | List selectMenuByAuthorityId(@Param("authorityId") String authorityId, @Param("authorityType") String authorityType); 21 | 22 | /** 23 | * selectAuthorityMenuByUserId 24 | * 25 | * @param userId 26 | * @return 27 | */ 28 | List selectAuthorityMenuByUserId(@Param("userId") int userId); 29 | 30 | /** 31 | * selectAuthoritySystemByUserId 32 | * 33 | * @param userId 34 | * @return 35 | */ 36 | List selectAuthoritySystemByUserId(@Param("userId") int userId); 37 | } -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/vo/CapitalVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.vo; 2 | 3 | import com.mvc.user.entity.Capital; 4 | import com.mvc.user.util.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * Capital vo 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/9 17:29 12 | */ 13 | @Data 14 | public class CapitalVO extends Capital { 15 | 16 | public Double getBalanceStr(){ 17 | return CoinUtil.wei2Value(super.getCoinId(), super.getBalance()); 18 | } 19 | 20 | public Double getLockStr(){ 21 | return CoinUtil.wei2Value(super.getCoinId(), super.getLocked()); 22 | } 23 | 24 | public Double getInterestStr(){ 25 | return CoinUtil.wei2Value(super.getCoinId(), super.getInterest()); 26 | } 27 | 28 | public String getUnit(){ 29 | return CoinUtil.getUnit(super.getCoinId()); 30 | } 31 | 32 | public String getName(){ 33 | return CoinUtil.getName(super.getCoinId()); 34 | } 35 | 36 | public String getNameEn(){ 37 | return CoinUtil.getNameEn(super.getCoinId()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/ElementMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.Element; 4 | import org.apache.ibatis.annotations.Param; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | public interface ElementMapper extends Mapper { 13 | /** 14 | * selectAuthorityElementByUserId 15 | * 16 | * @param userId 17 | * @return 18 | */ 19 | List selectAuthorityElementByUserId(@Param("userId") String userId); 20 | 21 | /** 22 | * selectAuthorityMenuElementByUserId 23 | * 24 | * @param userId 25 | * @param menuId 26 | * @return 27 | */ 28 | List selectAuthorityMenuElementByUserId(@Param("userId") String userId, @Param("menuId") String menuId); 29 | 30 | /** 31 | * selectAuthorityElementByClientId 32 | * 33 | * @param clientId 34 | * @return 35 | */ 36 | List selectAuthorityElementByClientId(@Param("clientId") String clientId); 37 | 38 | } -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/vo/CapitalVO.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.vo; 2 | 3 | import com.mvc.console.entity.Capital; 4 | import com.mvc.console.util.CoinUtil; 5 | import lombok.Data; 6 | 7 | /** 8 | * Capital vo 9 | * 10 | * @author qiyichen 11 | * @create 2018/1/9 17:29 12 | */ 13 | @Data 14 | public class CapitalVO extends Capital { 15 | 16 | public Double getBalanceStr(){ 17 | return CoinUtil.wei2Value(super.getCoinId(), super.getBalance()); 18 | } 19 | 20 | public Double getLockStr(){ 21 | return CoinUtil.wei2Value(super.getCoinId(), super.getLocked()); 22 | } 23 | 24 | public Double getInterestStr(){ 25 | return CoinUtil.wei2Value(super.getCoinId(), super.getInterest()); 26 | } 27 | 28 | public String getUnit(){ 29 | return CoinUtil.getUnit(super.getCoinId()); 30 | } 31 | 32 | public String getName(){ 33 | return CoinUtil.getName(super.getCoinId()); 34 | } 35 | 36 | public String getNameEn(){ 37 | return CoinUtil.getNameEn(super.getCoinId()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Pattern; 9 | import java.math.BigInteger; 10 | import java.util.Date; 11 | 12 | /** 13 | * @author qyc 14 | */ 15 | @Table(name = "user") 16 | @Data 17 | public class User { 18 | @Id 19 | private BigInteger id; 20 | 21 | @NotNull(message = "请输入密码") 22 | private String password; 23 | 24 | @Pattern(regexp = "^(0\\d{2}-\\d{8}(-\\d{1,4})?)|(0\\d{3}-\\d{7,8}(-\\d{1,4})?)|" + 25 | "(1(([3]\\d{9})|(4[57]\\d{8})|(5[0-3|5-9]\\d{8})|(7[0-3|5-8]\\d{8})|(8\\d{9})))$", message = "手机号格式不正确!") 26 | private String cellphone; 27 | 28 | private String addressEth; 29 | 30 | private Integer status; 31 | 32 | private Date createdAt; 33 | 34 | private Date updatedAt; 35 | 36 | private Date deletedAt; 37 | 38 | public void init() { 39 | this.status = 1; 40 | } 41 | } -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/service/AuthClientService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.service; 2 | 3 | 4 | import java.util.List; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface AuthClientService { 10 | /** 11 | * apply 12 | * 13 | * @param clientId 14 | * @param secret 15 | * @return 16 | * @throws Exception 17 | */ 18 | public String apply(String clientId, String secret) throws Exception; 19 | 20 | /** 21 | * 获取授权的客户端列表 22 | * 23 | * @param serviceId 24 | * @param secret 25 | * @return 26 | */ 27 | public List getAllowedClient(String serviceId, String secret); 28 | 29 | /** 30 | * 获取服务授权的客户端列表 31 | * 32 | * @param serviceId 33 | * @return 34 | */ 35 | public List getAllowedClient(String serviceId); 36 | 37 | /** 38 | * validate 39 | * 40 | * @param clientId 41 | * @param secret 42 | * @throws Exception 43 | */ 44 | public void validate(String clientId, String secret) throws Exception; 45 | } 46 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/exception/BaseException.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.exception; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class BaseException extends RuntimeException { 7 | private int status = 200; 8 | 9 | public int getStatus() { 10 | return status; 11 | } 12 | 13 | public void setStatus(int status) { 14 | this.status = status; 15 | } 16 | 17 | public BaseException() { 18 | } 19 | 20 | public BaseException(String message, int status) { 21 | super(message); 22 | this.status = status; 23 | } 24 | 25 | public BaseException(String message) { 26 | super(message); 27 | } 28 | 29 | public BaseException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | public BaseException(Throwable cause) { 34 | super(cause); 35 | } 36 | 37 | public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 38 | super(message, cause, enableSuppression, writableStackTrace); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/mapper/GroupMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.entity.Group; 4 | import org.apache.ibatis.annotations.Param; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public interface GroupMapper extends Mapper { 11 | /** 12 | * deleteGroupMembersById 13 | * 14 | * @param groupId 15 | */ 16 | void deleteGroupMembersById(@Param("groupId") int groupId); 17 | 18 | /** 19 | * deleteGroupLeadersById 20 | * 21 | * @param groupId 22 | */ 23 | void deleteGroupLeadersById(@Param("groupId") int groupId); 24 | 25 | /** 26 | * insertGroupMembersById 27 | * 28 | * @param groupId 29 | * @param userId 30 | */ 31 | void insertGroupMembersById(@Param("groupId") int groupId, @Param("userId") int userId); 32 | 33 | /** 34 | * insertGroupLeadersById 35 | * 36 | * @param groupId 37 | * @param userId 38 | */ 39 | void insertGroupLeadersById(@Param("groupId") int groupId, @Param("userId") int userId); 40 | } -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/constant/AdminCommonConstant.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.constant; 2 | 3 | /** 4 | * AdminCommonConstant 5 | * 6 | * @author qyc 7 | */ 8 | public class AdminCommonConstant { 9 | public final static int ROOT = -1; 10 | public final static int DEFAULT_GROUP_TYPE = 0; 11 | /** 12 | * 权限关联类型 13 | */ 14 | public final static String AUTHORITY_TYPE_GROUP = "group"; 15 | /** 16 | * 权限资源类型 17 | */ 18 | public final static String RESOURCE_TYPE_MENU = "menu"; 19 | public final static String RESOURCE_TYPE_BTN = "button"; 20 | 21 | public final static String RESOURCE_REQUEST_METHOD_GET = "GET"; 22 | public final static String RESOURCE_REQUEST_METHOD_PUT = "PUT"; 23 | public final static String RESOURCE_REQUEST_METHOD_DELETE = "DELETE"; 24 | public final static String RESOURCE_REQUEST_METHOD_POST = "POST"; 25 | 26 | public final static String RESOURCE_ACTION_VISIT = "访问"; 27 | 28 | public final static String BOOLEAN_NUMBER_FALSE = "0"; 29 | 30 | public final static String BOOLEAN_NUMBER_TRUE = "1"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/constant/UserCommonConstant.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.constant; 2 | 3 | /** 4 | * @author qyc 5 | * @create 2017-06-17 14:41 6 | */ 7 | public class UserCommonConstant { 8 | public final static int ROOT = -1; 9 | public final static int DEFAULT_GROUP_TYPE = 0; 10 | /** 11 | * 权限关联类型 12 | */ 13 | public final static String AUTHORITY_TYPE_GROUP = "group"; 14 | /** 15 | * 权限资源类型 16 | */ 17 | public final static String RESOURCE_TYPE_MENU = "menu"; 18 | public final static String RESOURCE_TYPE_BTN = "button"; 19 | 20 | public final static String RESOURCE_REQUEST_METHOD_GET = "GET"; 21 | public final static String RESOURCE_REQUEST_METHOD_PUT = "PUT"; 22 | public final static String RESOURCE_REQUEST_METHOD_DELETE = "DELETE"; 23 | public final static String RESOURCE_REQUEST_METHOD_POST = "POST"; 24 | 25 | public final static String RESOURCE_ACTION_VISIT = "访问"; 26 | 27 | public final static String BOOLEAN_NUMBER_FALSE = "0"; 28 | 29 | public final static String BOOLEAN_NUMBER_TRUE = "1"; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/constant/UserCommonConstant.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.constant; 2 | 3 | /** 4 | * ${DESCRIPTION} 5 | * 6 | * @author wanghaobin 7 | * @create 2017-06-17 14:41 8 | */ 9 | public class UserCommonConstant { 10 | public final static int ROOT = -1; 11 | public final static int DEFAULT_GROUP_TYPE = 0; 12 | /** 13 | * 权限关联类型 14 | */ 15 | public final static String AUTHORITY_TYPE_GROUP = "group"; 16 | /** 17 | * 权限资源类型 18 | */ 19 | public final static String RESOURCE_TYPE_MENU = "menu"; 20 | public final static String RESOURCE_TYPE_BTN = "button"; 21 | 22 | public final static String RESOURCE_REQUEST_METHOD_GET = "GET"; 23 | public final static String RESOURCE_REQUEST_METHOD_PUT = "PUT"; 24 | public final static String RESOURCE_REQUEST_METHOD_DELETE = "DELETE"; 25 | public final static String RESOURCE_REQUEST_METHOD_POST = "POST"; 26 | 27 | public final static String RESOURCE_ACTION_VISIT = "访问"; 28 | 29 | public final static String BOOLEAN_NUMBER_FALSE = "0"; 30 | 31 | public final static String BOOLEAN_NUMBER_TRUE = "1"; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/Result.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | /** 6 | * 统一API响应结果封装 7 | * 8 | * @author 张洁 9 | * @date 2017/11/02 10 | */ 11 | @SuppressWarnings("unused") 12 | public class Result { 13 | @JsonProperty("status") 14 | private int code; 15 | private String message; 16 | private T data; 17 | 18 | public Result setCode(ResultCode resultCode) { 19 | this.code = resultCode.code; 20 | return this; 21 | } 22 | 23 | public int getCode() { 24 | return code; 25 | } 26 | 27 | public Result setCode(int code) { 28 | this.code = code; 29 | return this; 30 | } 31 | 32 | public String getMessage() { 33 | return message; 34 | } 35 | 36 | public Result setMessage(String message) { 37 | this.message = message; 38 | return this; 39 | } 40 | 41 | public T getData() { 42 | return data; 43 | } 44 | 45 | public Result setData(T data) { 46 | this.data = data; 47 | return this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/constant/UserCommonConstant.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.constant; 2 | 3 | /** 4 | * ${DESCRIPTION} 5 | * 6 | * @author wanghaobin 7 | * @create 2017-06-17 14:41 8 | */ 9 | public class UserCommonConstant { 10 | public final static int ROOT = -1; 11 | public final static int DEFAULT_GROUP_TYPE = 0; 12 | /** 13 | * 权限关联类型 14 | */ 15 | public final static String AUTHORITY_TYPE_GROUP = "group"; 16 | /** 17 | * 权限资源类型 18 | */ 19 | public final static String RESOURCE_TYPE_MENU = "menu"; 20 | public final static String RESOURCE_TYPE_BTN = "button"; 21 | 22 | public final static String RESOURCE_REQUEST_METHOD_GET = "GET"; 23 | public final static String RESOURCE_REQUEST_METHOD_PUT = "PUT"; 24 | public final static String RESOURCE_REQUEST_METHOD_DELETE = "DELETE"; 25 | public final static String RESOURCE_REQUEST_METHOD_POST = "POST"; 26 | 27 | public final static String RESOURCE_ACTION_VISIT = "访问"; 28 | 29 | public final static String BOOLEAN_NUMBER_FALSE = "0"; 30 | 31 | public final static String BOOLEAN_NUMBER_TRUE = "1"; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/config/druid/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config.druid; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.annotation.WebInitParam; 11 | import java.io.IOException; 12 | 13 | /** 14 | * ${DESCRIPTION} 15 | * 16 | * @author wanghaobin 17 | * @create 2017-06-20 21:34 18 | */ 19 | @WebFilter(filterName="druidWebStatFilter",urlPatterns="/druid/*", 20 | initParams={ 21 | @WebInitParam(name="exclusions",value="*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源 22 | }) 23 | public class DruidStatFilter extends WebStatFilter { 24 | 25 | @Override 26 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 27 | response.setContentType("text/html"); 28 | super.doFilter(request, response, chain); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/config/druid/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config.druid; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.annotation.WebInitParam; 11 | import java.io.IOException; 12 | 13 | /** 14 | * ${DESCRIPTION} 15 | * 16 | * @author wanghaobin 17 | * @create 2017-06-20 21:34 18 | */ 19 | @WebFilter(filterName="druidWebStatFilter",urlPatterns="/druid/*", 20 | initParams={ 21 | @WebInitParam(name="exclusions",value="*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源 22 | }) 23 | public class DruidStatFilter extends WebStatFilter { 24 | 25 | @Override 26 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 27 | response.setContentType("text/html"); 28 | super.doFilter(request, response, chain); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/util/UUIDUtils.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.util; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * @author qyc 7 | */ 8 | public class UUIDUtils { 9 | 10 | private final static Integer LIMIT = 8; 11 | public static String[] chars = new String[]{"a", "b", "c", "d", "e", "f", 12 | "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", 13 | "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", 14 | "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", 15 | "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", 16 | "W", "X", "Y", "Z"}; 17 | 18 | 19 | public static String generateShortUuid() { 20 | StringBuffer shortBuffer = new StringBuffer(); 21 | String uuid = UUID.randomUUID().toString().replace("-", ""); 22 | for (int i = 0; i < LIMIT; i++) { 23 | String str = uuid.substring(i * 4, i * 4 + 4); 24 | int x = Integer.parseInt(str, 16); 25 | shortBuffer.append(chars[x % 0x3E]); 26 | } 27 | return shortBuffer.toString(); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/interceptor/ClientTokenInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.interceptor; 2 | 3 | import com.mvc.auth.configuration.ClientConfiguration; 4 | import com.mvc.auth.service.AuthClientService; 5 | import feign.RequestInterceptor; 6 | import feign.RequestTemplate; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | public class ClientTokenInterceptor implements RequestInterceptor { 15 | private Logger logger = LoggerFactory.getLogger(ClientTokenInterceptor.class); 16 | @Autowired 17 | private ClientConfiguration clientConfiguration; 18 | @Autowired 19 | private AuthClientService authClientService; 20 | 21 | @Override 22 | public void apply(RequestTemplate requestTemplate) { 23 | try { 24 | requestTemplate.header(clientConfiguration.getClientTokenHeader(), authClientService.apply(clientConfiguration.getClientId(), clientConfiguration.getClientSecret())); 25 | } catch (Exception e) { 26 | e.printStackTrace(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/config/druid/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config.druid; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.annotation.WebInitParam; 11 | import java.io.IOException; 12 | 13 | /** 14 | * ${DESCRIPTION} 15 | * 16 | * @author wanghaobin 17 | * @create 2017-06-20 21:34 18 | */ 19 | @WebFilter(filterName="druidWebStatFilter",urlPatterns="/druid/*", 20 | initParams={ 21 | @WebInitParam(name="exclusions",value="*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源 22 | }) 23 | public class DruidStatFilter extends WebStatFilter { 24 | 25 | @Override 26 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 27 | response.setContentType("text/html"); 28 | super.doFilter(request, response, chain); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/config/druid/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config.druid; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.annotation.WebInitParam; 11 | import java.io.IOException; 12 | 13 | /** 14 | * ${DESCRIPTION} 15 | * 16 | * @author wanghaobin 17 | * @create 2017-06-20 21:34 18 | */ 19 | @WebFilter(filterName="druidWebStatFilter",urlPatterns="/druid/*", 20 | initParams={ 21 | @WebInitParam(name="exclusions",value="*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源 22 | }) 23 | public class DruidStatFilter extends WebStatFilter { 24 | 25 | @Override 26 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 27 | response.setContentType("text/html"); 28 | super.doFilter(request, response, chain); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/mapper/LockRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.mapper; 2 | 3 | import com.mvc.common.dto.LockRecordDTO; 4 | import com.mvc.ethereum.model.LockRecord; 5 | import com.mvc.ethereum.model.vo.LockRecordVO; 6 | import org.apache.ibatis.annotations.Select; 7 | import tk.mybatis.mapper.common.Mapper; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | public interface LockRecordMapper extends Mapper { 15 | /** 16 | * list 17 | * 18 | * @param lockRecordDTO 19 | * @return 20 | */ 21 | @Select({""}) 29 | List list(LockRecordDTO lockRecordDTO); 30 | 31 | /** 32 | * selectUnlock 33 | * 34 | * @return 35 | */ 36 | @Select("SELECT * FROM lock_record WHERE updated_at <= now() and status = 0") 37 | List selectUnlock(); 38 | } -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/java/com/mvc/gate/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | @Configuration 12 | public class CorsConfig { 13 | 14 | private CorsConfiguration buildConfig() { 15 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 16 | corsConfiguration.addAllowedOrigin("*"); 17 | corsConfiguration.addAllowedHeader("*"); 18 | corsConfiguration.addAllowedMethod("*"); 19 | corsConfiguration.setAllowCredentials(true); 20 | return corsConfiguration; 21 | } 22 | 23 | @Bean 24 | public org.springframework.web.filter.CorsFilter corsFilter() { 25 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 26 | source.registerCorsConfiguration("/**", buildConfig()); 27 | return new org.springframework.web.filter.CorsFilter(source); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/util/user/JwtTokenUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.util.user; 2 | 3 | import com.mvc.auth.common.util.jwt.IJWTInfo; 4 | import com.mvc.auth.common.util.jwt.JWTHelper; 5 | import com.mvc.auth.configuration.KeyConfiguration; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.data.redis.core.RedisTemplate; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | @Component 15 | public class JwtTokenUtil { 16 | 17 | @Value("${jwt.expire}") 18 | private int expire; 19 | @Autowired 20 | private KeyConfiguration keyConfiguration; 21 | 22 | @Autowired 23 | private RedisTemplate redisTemplate; 24 | 25 | public String generateToken(IJWTInfo jwtInfo) throws Exception { 26 | return JWTHelper.generateToken(jwtInfo, keyConfiguration.getUserPriKey(), expire); 27 | } 28 | 29 | public IJWTInfo getInfoFromToken(String token) throws Exception { 30 | return JWTHelper.getInfoFromToken(token, keyConfiguration.getUserPubKey()); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-common/src/main/java/com/mvc/auth/common/constatns/CommonConstants.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.common.constatns; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class CommonConstants { 7 | public final static String RESOURCE_TYPE_MENU = "menu"; 8 | public final static String RESOURCE_TYPE_BTN = "button"; 9 | public static final Integer EX_TOKEN_ERROR_CODE = 40101; 10 | public static final Integer EX_USER_INVALID_CODE = 40102; 11 | public static final Integer EX_CLIENT_INVALID_CODE = 40131; 12 | public static final Integer EX_CLIENT_FORBIDDEN_CODE = 40331; 13 | public static final Integer EX_OTHER_CODE = 500; 14 | public static final String CONTEXT_KEY_USER_ID = "currentUserId"; 15 | public static final String CONTEXT_KEY_USERNAME = "currentUserName"; 16 | public static final String CONTEXT_KEY_USER_NAME = "currentUser"; 17 | public static final String CONTEXT_KEY_USER_TOKEN = "currentUserToken"; 18 | public static final String JWT_KEY_ADDRESS = "address"; 19 | public static final String JWT_KEY_USER_ID = "userId"; 20 | public static final String JWT_KEY_NAME = "name"; 21 | 22 | public static final String USER_STATUS = "USER_STATUS_"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/util/client/ClientTokenUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.util.client; 2 | 3 | import com.mvc.auth.common.util.jwt.IJWTInfo; 4 | import com.mvc.auth.common.util.jwt.JWTHelper; 5 | import com.mvc.auth.configuration.KeyConfiguration; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * @author qyc 14 | */ 15 | @Configuration 16 | public class ClientTokenUtil { 17 | private Logger logger = LoggerFactory.getLogger(ClientTokenUtil.class); 18 | 19 | @Value("${client.expire}") 20 | private int expire; 21 | @Autowired 22 | private KeyConfiguration keyConfiguration; 23 | 24 | public String generateToken(IJWTInfo jwtInfo) throws Exception { 25 | return JWTHelper.generateToken(jwtInfo, keyConfiguration.getServicePriKey(), expire); 26 | } 27 | 28 | public IJWTInfo getInfoFromToken(String token) throws Exception { 29 | return JWTHelper.getInfoFromToken(token, keyConfiguration.getServicePubKey()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rpc/service/EthernumService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rpc.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.mvc.common.msg.Result; 5 | import com.mvc.console.dto.SendTransactionDTO; 6 | import org.springframework.cloud.netflix.feign.FeignClient; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | @FeignClient("mvc-etherenum") 13 | public interface EthernumService { 14 | /** 15 | * approveAndCall 16 | * 17 | * @param contractAddress 18 | * @param sendTransactionDTO 19 | * @param authorization 20 | * @return 21 | */ 22 | @RequestMapping(value = "/{contractAddress}/eth_sendTransaction", method = RequestMethod.POST) 23 | Result approveAndCall(@PathVariable("contractAddress") String contractAddress, @RequestBody SendTransactionDTO sendTransactionDTO, @RequestHeader("Authorization") String authorization); 24 | 25 | /** 26 | * getAccount 27 | * 28 | * @param type 29 | * @return 30 | */ 31 | @RequestMapping(value = "ethereum/wallet_account", method = RequestMethod.GET) 32 | Result getAccount(@RequestParam("type") String type); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/util/CoinUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.util; 2 | 3 | import com.mvc.console.entity.CoinInfo; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | import java.math.BigInteger; 8 | import java.util.HashMap; 9 | 10 | /** 11 | * coin trans util 12 | * 13 | * @author qiyichen 14 | * @create 2018/1/9 17:38 15 | */ 16 | @Data 17 | public class CoinUtil { 18 | 19 | public static HashMap coinMap = new HashMap<>(); 20 | 21 | public static Double wei2Value(BigInteger coinId, BigInteger balance) { 22 | CoinInfo coinInfo = coinMap.get(coinId); 23 | BigDecimal b = new BigDecimal(balance); 24 | 25 | 26 | Double rslt = b.divide(new BigDecimal(coinInfo.getRatio()), coinInfo.getDigit(), BigDecimal.ROUND_HALF_UP).doubleValue(); 27 | return rslt; 28 | } 29 | 30 | public static String getUnit(BigInteger coinId) { 31 | return coinMap.get(coinId).getAbbr(); 32 | } 33 | 34 | public static String getName(BigInteger coinId) { 35 | return coinMap.get(coinId).getName(); 36 | } 37 | 38 | public static String getNameEn(BigInteger coinId) { 39 | return coinMap.get(coinId).getNameEn(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/service/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.service; 2 | 3 | 4 | import java.math.BigInteger; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public interface AuthService { 10 | /** 11 | * login 12 | * 13 | * @param username 14 | * @param password 15 | * @return 16 | * @throws Exception 17 | */ 18 | String login(String username, String password) throws Exception; 19 | 20 | /** 21 | * refresh 22 | * 23 | * @param oldToken 24 | * @return 25 | */ 26 | String refresh(String oldToken); 27 | 28 | /** 29 | * validate 30 | * 31 | * @param token 32 | * @throws Exception 33 | */ 34 | void validate(String token) throws Exception; 35 | 36 | /** 37 | * invalid 38 | * 39 | * @param token 40 | * @return 41 | */ 42 | Boolean invalid(String token); 43 | 44 | /** 45 | * loginUser 46 | * 47 | * @param username 48 | * @param clientId 49 | * @param userId 50 | * @param address 51 | * @return 52 | * @throws Exception 53 | */ 54 | String loginUser(String username, String clientId, BigInteger userId, String address) throws Exception; 55 | } 56 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/configuration/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.configuration; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | 8 | import java.util.Arrays; 9 | 10 | /** 11 | * @author qyc 12 | */ 13 | public class CorsConfig { 14 | 15 | @Value("${cors.allowedOrigin}") 16 | private String allowedOrigin; 17 | 18 | private CorsConfiguration buildConfig() { 19 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 20 | corsConfiguration.setAllowedOrigins(Arrays.asList(allowedOrigin)); 21 | corsConfiguration.addAllowedHeader("*"); 22 | corsConfiguration.addAllowedMethod("*"); 23 | return corsConfiguration; 24 | } 25 | 26 | @Bean 27 | public org.springframework.web.filter.CorsFilter corsFilter() { 28 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 29 | source.registerCorsConfiguration("/**", buildConfig()); 30 | return new org.springframework.web.filter.CorsFilter(source); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/rpc/service/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc.service; 2 | 3 | import com.mvc.common.msg.Result; 4 | import com.mvc.user.dto.TokenDTO; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RequestParam; 10 | 11 | /** 12 | * sms remote rpc 13 | * 14 | * @author qiyichen 15 | * @create 2018/1/8 21:48 16 | */ 17 | @FeignClient("mvc-auth") 18 | public interface AuthService { 19 | 20 | /** 21 | * createUserAuthenticationToken 22 | * 23 | * @param tokenDTO 24 | * @return 25 | */ 26 | @RequestMapping(value = "jwt/user/token", method = RequestMethod.POST) 27 | public Result createUserAuthenticationToken(@RequestBody TokenDTO tokenDTO); 28 | 29 | /** 30 | * valicode 31 | * 32 | * @param valiCode 33 | * @return 34 | * @throws Exception 35 | */ 36 | @RequestMapping(value = "client/validate", method = RequestMethod.GET) 37 | public Result valicode(@RequestParam("valiCode") String valiCode) throws Exception; 38 | } 39 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/controller/ServiceController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.controller; 2 | 3 | import com.mvc.auth.biz.ClientBiz; 4 | import com.mvc.auth.entity.Client; 5 | import com.mvc.auth.entity.ClientService; 6 | import com.mvc.common.msg.ObjectRestResponse; 7 | import com.mvc.common.rest.BaseController; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.io.UnsupportedEncodingException; 11 | 12 | /** 13 | * @author ace 14 | * @create 2017/12/26. 15 | */ 16 | @RestController 17 | @RequestMapping("service") 18 | public class ServiceController extends BaseController{ 19 | 20 | @RequestMapping(value = "/{id}/client", method = RequestMethod.PUT) 21 | @ResponseBody 22 | public ObjectRestResponse modifyUsers(@PathVariable int id, String clients) throws UnsupportedEncodingException { 23 | baseBiz.modifyClientServices(id, clients); 24 | return new ObjectRestResponse().rel(true); 25 | } 26 | 27 | @RequestMapping(value = "/{id}/client", method = RequestMethod.GET) 28 | @ResponseBody 29 | public ObjectRestResponse getUsers(@PathVariable int id){ 30 | return new ObjectRestResponse().rel(true).data(baseBiz.getClientServices(id)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/mapper/TransactionMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.mapper; 2 | 3 | import com.mvc.console.dto.TransactionDTO; 4 | import com.mvc.console.entity.Transaction; 5 | import com.mvc.console.vo.TransactionVO; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | import tk.mybatis.mapper.common.Mapper; 9 | 10 | import java.math.BigInteger; 11 | import java.util.List; 12 | 13 | /** 14 | * @author qyc 15 | */ 16 | public interface TransactionMapper extends Mapper { 17 | /** 18 | * list 19 | * 20 | * @param transactionDTO 21 | * @return 22 | */ 23 | @Select("select * from transaction where type in (${types}) and user_id = #{userId} order by created_at desc") 24 | List list(TransactionDTO transactionDTO); 25 | 26 | /** 27 | * costByDay 28 | * 29 | * @param userId 30 | * @param coinId 31 | * @param date 32 | * @return 33 | */ 34 | @Select("SELECT SUM(quantity) FROM `transaction` WHERE user_id = #{userId} AND type = 1 AND coin_id = #{coinId} AND CAST(created_at AS DATE)=DATE #{data}") 35 | BigInteger costByDay(@Param("userId") BigInteger userId, @Param("coinId") BigInteger coinId, @Param("data") String date); 36 | } -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rest/RefundApplicationController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.context.BaseContextHandler; 4 | import com.mvc.common.msg.Result; 5 | import com.mvc.common.msg.ResultGenerator; 6 | import com.mvc.common.rest.BaseController; 7 | import com.mvc.console.service.RefundApplicationService; 8 | import com.mvc.console.entity.RefundApplication; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.io.UnsupportedEncodingException; 12 | import java.math.BigInteger; 13 | 14 | /** 15 | * ${DESCRIPTION} 16 | * 17 | * @author wanghaobin 18 | * @create 2017-06-08 11:51 19 | */ 20 | @RestController 21 | @RequestMapping("refund") 22 | public class RefundApplicationController extends BaseController { 23 | 24 | 25 | @RequestMapping(value = "application", method = RequestMethod.POST) 26 | public @ResponseBody 27 | Result getBalance(@RequestBody RefundApplication refundApplication) throws UnsupportedEncodingException { 28 | refundApplication.setUserId(new BigInteger(BaseContextHandler.getUserID())); 29 | refundApplication.setStatus(0); 30 | add(refundApplication); 31 | return ResultGenerator.genSuccessResult(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/rpc/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rpc.service; 2 | 3 | import com.mvc.common.msg.Result; 4 | import com.mvc.console.dto.PwdCheckDTO; 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestHeader; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | 11 | /** 12 | * sms remote rpc 13 | * 14 | * @author qiyichen 15 | * @create 2018/1/8 21:48 16 | */ 17 | @FeignClient("mvc-user") 18 | public interface UserService { 19 | /** 20 | * checkPwd 21 | * 22 | * @param pwdCheckDTO 23 | * @param authorization 24 | * @return 25 | */ 26 | @RequestMapping(value = "checkPwd", method = RequestMethod.POST) 27 | Result checkPwd(@RequestBody PwdCheckDTO pwdCheckDTO, @RequestHeader("Authorization") String authorization); 28 | 29 | /** 30 | * getEthnumKey 31 | * 32 | * @param authorization 33 | * @return 34 | */ 35 | @RequestMapping(value = "ethnumKey", method = RequestMethod.GET) 36 | Result getEthnumKey(@RequestHeader("Authorization") String authorization); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/util/Query.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.util; 2 | 3 | 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | 7 | /** 8 | * @author qyc 9 | */ 10 | public class Query extends LinkedHashMap { 11 | private static final long serialVersionUID = 1L; 12 | 13 | private final static String PAGE_NO = "pageNo"; 14 | private final static String PAGE_SIZE = "pageSize"; 15 | private int page = 1; 16 | private int limit = 10; 17 | 18 | public Query(Map params) { 19 | this.putAll(params); 20 | //分页参数 21 | if (params.get(PAGE_NO) != null) { 22 | this.page = Integer.parseInt(params.get(PAGE_NO).toString()); 23 | } 24 | if (params.get(PAGE_SIZE) != null) { 25 | this.limit = Integer.parseInt(params.get(PAGE_SIZE).toString()); 26 | } 27 | this.remove(PAGE_NO); 28 | this.remove(PAGE_SIZE); 29 | } 30 | 31 | 32 | public int getPage() { 33 | return page; 34 | } 35 | 36 | public void setPage(int page) { 37 | this.page = page; 38 | } 39 | 40 | public int getLimit() { 41 | return limit; 42 | } 43 | 44 | public void setLimit(int limit) { 45 | this.limit = limit; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/ConsoleBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console; 2 | 3 | import com.ace.cache.EnableAceCache; 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.ServletComponentScan; 8 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 9 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 10 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 11 | import org.springframework.scheduling.annotation.EnableScheduling; 12 | import org.springframework.transaction.annotation.EnableTransactionManagement; 13 | 14 | /** 15 | * @author qyc 16 | */ 17 | @EnableEurekaClient 18 | @EnableCircuitBreaker 19 | @SpringBootApplication 20 | @EnableFeignClients({"com.mvc.console.rpc.service", "com.mvc.auth.client.feign"}) 21 | @EnableScheduling 22 | @EnableAceAuthClient 23 | @ServletComponentScan({"com.mvc.user.config.druid"}) 24 | @EnableAceCache 25 | @EnableTransactionManagement 26 | public class ConsoleBootstrap { 27 | public static void main(String[] args) { 28 | new SpringApplicationBuilder(ConsoleBootstrap.class).web(true).run(args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/ListRestResponse.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | /** 4 | * ${DESCRIPTION} 5 | * 6 | * @author wanghaobin 7 | * @create 2017-06-09 7:32 8 | */ 9 | public class ListRestResponse { 10 | String msg; 11 | T result; 12 | int count; 13 | 14 | 15 | 16 | public String getMsg() { 17 | return msg; 18 | } 19 | 20 | public void setMsg(String msg) { 21 | this.msg = msg; 22 | } 23 | 24 | public T getResult() { 25 | return result; 26 | } 27 | 28 | public void setResult(T result) { 29 | this.result = result; 30 | } 31 | 32 | public int getCount() { 33 | return count; 34 | } 35 | 36 | public void setCount(int count) { 37 | this.count = count; 38 | } 39 | 40 | public ListRestResponse count(int count) { 41 | this.setCount(count); 42 | return this; 43 | } 44 | 45 | public ListRestResponse count(Long count) { 46 | this.setCount(count.intValue()); 47 | return this; 48 | } 49 | 50 | public ListRestResponse msg(String msg) { 51 | this.setMsg(msg); 52 | return this; 53 | } 54 | 55 | public ListRestResponse result(T result) { 56 | this.setResult(result); 57 | return this; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/config/RateLimiter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.mvc.gate.ratelimit.config; 18 | 19 | import com.mvc.gate.ratelimit.config.properties.RateLimitProperties.Policy; 20 | 21 | /** 22 | * @author Marcos Barbero 23 | */ 24 | public interface RateLimiter { 25 | 26 | /** 27 | * consume 28 | * @param policy - Template for which rates should be created in case there's no rate limit associated with the key 29 | * @param key - Unique key that identifies a request 30 | * @return a view of a user's rate request limit 31 | */ 32 | Rate consume(Policy policy, String key); 33 | } 34 | -------------------------------------------------------------------------------- /mvc-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | mvc-wallet 7 | com.mvc 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | mvc-api 13 | 14 | 15 | 16 | org.springframework.cloud 17 | spring-cloud-starter-feign 18 | 19 | 20 | 21 | 22 | 23 | releases 24 | Nexus Release Repository 25 | http://192.168.206.233:8081/nexus/content/repositories/releases/ 26 | 27 | 28 | snapshots 29 | Nexus Snapshot Repository 30 | http://192.168.206.233:8081/nexus/content/repositories/snapshots/ 31 | 32 | 33 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/rest/ConfigController.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.rest; 2 | 3 | import com.mvc.common.msg.Result; 4 | import com.mvc.common.msg.ResultGenerator; 5 | import com.mvc.common.rest.BaseController; 6 | import com.mvc.console.service.ConfigService; 7 | import com.mvc.console.entity.CoinInfo; 8 | import com.mvc.console.entity.Config; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | 16 | /** 17 | * config controller 18 | * 19 | * @author qiyichen 20 | * @create 2018/1/10 14:07 21 | */ 22 | @Controller 23 | @RequestMapping("config") 24 | public class ConfigController extends BaseController { 25 | 26 | @Autowired 27 | private ConfigService configService; 28 | 29 | @RequestMapping(value = "save", method = RequestMethod.POST) 30 | public @ResponseBody Result insert(@RequestBody Config config){ 31 | configService.insertOrUpdate(config); 32 | return ResultGenerator.genSuccessResult("ok"); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/visitor/AbstractBlockchainVisitor.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.visitor; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.mvc.ethereum.model.Account; 5 | import com.mvc.ethereum.model.Method; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | 10 | /** 11 | * @author qyc 12 | */ 13 | @JsonIgnoreProperties(ignoreUnknown = true) 14 | @ToString 15 | public abstract class AbstractBlockchainVisitor { 16 | 17 | public AbstractBlockchainVisitor(Method createMethod) { 18 | this.createMethod = createMethod; 19 | } 20 | 21 | @Getter 22 | @Setter 23 | private Method method; 24 | 25 | @Getter 26 | private Method createMethod; 27 | 28 | @Setter 29 | @Getter 30 | private Account account; 31 | 32 | @Getter 33 | @Setter 34 | private String address; 35 | 36 | @Setter 37 | @Getter 38 | private T model; 39 | 40 | /** 41 | * getContent 42 | * 43 | * @return 44 | */ 45 | public abstract String getContent(); 46 | 47 | /** 48 | * getName 49 | * 50 | * @return 51 | */ 52 | public abstract String getName(); 53 | 54 | public Object[] getCreateArgs() { 55 | return createMethod.getArgs(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/mapper/CapitalMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.mapper; 2 | 3 | 4 | import com.mvc.ethereum.model.Capital; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Update; 7 | import tk.mybatis.mapper.common.Mapper; 8 | 9 | import java.math.BigInteger; 10 | 11 | /** 12 | * @author qyc 13 | */ 14 | public interface CapitalMapper extends Mapper { 15 | /** 16 | * updateBalance 17 | * 18 | * @param coinId 19 | * @param userId 20 | * @param value 21 | * @return 22 | */ 23 | @Update("update capital set balance = ( balance + ${value} ) where coin_id = #{coinId} and user_id = #{userId}") 24 | Integer updateBalance(@Param("coinId") BigInteger coinId, @Param("userId") BigInteger userId, @Param("value") String value); 25 | 26 | /** 27 | * updateLockBalance 28 | * 29 | * @param coinId 30 | * @param userId 31 | * @param value 32 | * @param locked 33 | * @return 34 | */ 35 | @Update("update capital set balance = ( balance + ${value} ), locked = ( locked - ${locked}) where coin_id = #{coinId} and user_id = #{userId}") 36 | Integer updateLockBalance(@Param("coinId") BigInteger coinId, @Param("userId") BigInteger userId, @Param("value") String value, @Param("locked") String locked); 37 | } -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/EthereumApplication.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum; 2 | 3 | import com.ace.cache.EnableAceCache; 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.web.servlet.ServletComponentScan; 8 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 9 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 10 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 11 | import org.springframework.scheduling.annotation.EnableAsync; 12 | import org.springframework.scheduling.annotation.EnableScheduling; 13 | import org.springframework.transaction.annotation.EnableTransactionManagement; 14 | 15 | /** 16 | * @author qyc 17 | */ 18 | @EnableEurekaClient 19 | @EnableCircuitBreaker 20 | @SpringBootApplication 21 | @EnableFeignClients({"com.mvc.auth.client.feign"}) 22 | @EnableScheduling 23 | @EnableAceAuthClient 24 | @ServletComponentScan("com.mvc.user.config.druid") 25 | @EnableAceCache 26 | @EnableTransactionManagement 27 | @EnableAsync 28 | public class EthereumApplication { 29 | public static void main(String[] args) throws Exception { 30 | SpringApplication.run(EthereumApplication.class, args); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/constant/CommonConstants.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.constant; 2 | 3 | /** 4 | * @author qyc 5 | */ 6 | public class CommonConstants { 7 | public final static String RESOURCE_TYPE_MENU = "menu"; 8 | public final static String RESOURCE_TYPE_BTN = "button"; 9 | public static final Integer EX_TOKEN_ERROR_CODE = 40101; 10 | public static final Integer EX_USER_INVALID_CODE = 40102; 11 | public static final Integer EX_CLIENT_INVALID_CODE = 40131; 12 | public static final Integer EX_CLIENT_FORBIDDEN_CODE = 40331; 13 | public static final Integer EX_OTHER_CODE = 500; 14 | public static final String CONTEXT_KEY_USER_ID = "currentUserId"; 15 | public static final String CONTEXT_KEY_USERNAME = "currentUserName"; 16 | public static final String CONTEXT_KEY_ADDRESS = "currentUserAddress"; 17 | public static final String CONTEXT_KEY_USER_NAME = "currentUser"; 18 | public static final String CONTEXT_KEY_USER_TOKEN = "currentUserToken"; 19 | public static final String JWT_KEY_USER_ID = "userId"; 20 | public static final String JWT_KEY_NAME = "name"; 21 | 22 | public static final String SMS_VALI_PRE = "smsValiCode_"; 23 | public static final Integer DEPOSITE = 0; 24 | public static final Integer SUCCESS = 2; 25 | 26 | 27 | public static final String LIMIT_LIST = "LIMIT_ACCOUNT"; 28 | } 29 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/visitor/VisitorFactory.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.visitor; 2 | 3 | import com.mvc.ethereum.model.Account; 4 | import com.mvc.ethereum.model.Method; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | * @author qyc 10 | */ 11 | public class VisitorFactory { 12 | 13 | public static Method buildMethod(final Optional name, final Optional args) { 14 | return Method.builder().name(name.isPresent() ? name.get() : null).args(args.isPresent() ? args.get() : null).build(); 15 | } 16 | 17 | public static AbstractBlockchainVisitor build(final String contractAddress, final String accountAddress, final String pwd, final String name, final String content, final T model, Method method) { 18 | Account account = Account.builder().address(accountAddress).passphrase(pwd).build(); 19 | 20 | AbstractBlockchainVisitor visitor = new AbstractBlockchainVisitor(method) { 21 | 22 | @Override 23 | public String getContent() { 24 | return content; 25 | } 26 | 27 | @Override 28 | public String getName() { 29 | return name; 30 | } 31 | }; 32 | visitor.setAccount(account); 33 | visitor.setModel(model); 34 | visitor.setAddress(contractAddress); 35 | return visitor; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/AdminConsoleBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console; 2 | 3 | import com.ace.cache.EnableAceCache; 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.ServletComponentScan; 8 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 9 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 10 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 11 | import org.springframework.scheduling.annotation.EnableScheduling; 12 | import org.springframework.transaction.annotation.EnableTransactionManagement; 13 | 14 | /** 15 | * ${DESCRIPTION} 16 | * 17 | * @author wanghaobin 18 | * @create 2017-05-25 12:44 19 | */ 20 | @EnableEurekaClient 21 | @EnableCircuitBreaker 22 | @SpringBootApplication 23 | @EnableFeignClients({"com.mvc.console.rpc.service", "com.mvc.auth.client.feign"}) 24 | @EnableScheduling 25 | @EnableAceAuthClient 26 | @ServletComponentScan({"com.mvc.user.config.druid"}) 27 | @EnableAceCache 28 | @EnableTransactionManagement 29 | public class AdminConsoleBootstrap { 30 | public static void main(String[] args) { 31 | new SpringApplicationBuilder(AdminConsoleBootstrap.class).web(true).run(args); } 32 | } 33 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/AdminBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user; 2 | 3 | import com.ace.cache.EnableAceCache; 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.ServletComponentScan; 8 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 9 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 10 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 11 | import org.springframework.scheduling.annotation.EnableAsync; 12 | import org.springframework.scheduling.annotation.EnableScheduling; 13 | import org.springframework.transaction.annotation.EnableTransactionManagement; 14 | 15 | /** 16 | * @author qyc 17 | * @create 2017-05-25 12:44 18 | */ 19 | @EnableEurekaClient 20 | @EnableCircuitBreaker 21 | @SpringBootApplication 22 | @EnableFeignClients({"com.mvc.auth.client.feign", "com.mvc.user.rpc"}) 23 | @EnableScheduling 24 | @EnableAceAuthClient 25 | @ServletComponentScan({"com.mvc.user.config.druid", "com.mvc.common.web"}) 26 | @EnableAceCache 27 | @EnableTransactionManagement 28 | @EnableAsync 29 | public class AdminBootstrap { 30 | public static void main(String[] args) { 31 | new SpringApplicationBuilder(AdminBootstrap.class).web(true).run(args); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /mvc-common/src/main/java/com/mvc/common/msg/ResultGenerator.java: -------------------------------------------------------------------------------- 1 | package com.mvc.common.msg; 2 | 3 | /** 4 | * 响应结果生成工具 5 | * 6 | * @author 张洁 7 | * @date 2017/11/02 8 | */ 9 | @SuppressWarnings("unused") 10 | public class ResultGenerator { 11 | private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS"; 12 | 13 | public static Result genSuccessResult() { 14 | return new Result() 15 | .setCode(ResultCode.SUCCESS) 16 | .setMessage(DEFAULT_SUCCESS_MESSAGE); 17 | } 18 | 19 | public static Result genSuccessResult(T data) { 20 | return new Result() 21 | .setCode(ResultCode.SUCCESS) 22 | .setMessage(DEFAULT_SUCCESS_MESSAGE) 23 | .setData(data); 24 | } 25 | 26 | public static Result genFailResult(String message) { 27 | return new Result() 28 | .setCode(ResultCode.FAILURE) 29 | .setMessage(message); 30 | } 31 | 32 | public static Result genFailResult(String message, Object data) { 33 | return new Result() 34 | .setCode(ResultCode.FAILURE) 35 | .setMessage(message) 36 | .setData(data); 37 | } 38 | 39 | public static Result genFailResult(Integer code, String message) { 40 | return new Result() 41 | .setCode(code) 42 | .setMessage(message); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/java/com/mvc/gate/GateBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate; 2 | 3 | 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import com.mvc.gate.config.UserPrincipal; 6 | import com.mvc.gate.ratelimit.EnableAceGateRateLimit; 7 | import com.mvc.gate.ratelimit.config.IUserPrincipal; 8 | import com.mvc.gate.utils.DbLog; 9 | import org.springframework.boot.SpringApplication; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 12 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 13 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 14 | import org.springframework.context.annotation.Bean; 15 | import org.springframework.context.annotation.Primary; 16 | import org.springframework.scheduling.annotation.EnableScheduling; 17 | 18 | /** 19 | * @author qyc 20 | */ 21 | @SpringBootApplication 22 | @EnableDiscoveryClient 23 | @EnableFeignClients({"com.mvc.auth.client.feign", "com.mvc.gate.feign"}) 24 | @EnableZuulProxy 25 | @EnableScheduling 26 | @EnableAceAuthClient 27 | @EnableAceGateRateLimit 28 | public class GateBootstrap { 29 | public static void main(String[] args) { 30 | DbLog.getInstance().start(); 31 | SpringApplication.run(GateBootstrap.class, args); 32 | } 33 | 34 | @Bean 35 | @Primary 36 | IUserPrincipal userPrincipal() { 37 | return new UserPrincipal(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/model/vo/LockCount.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.model.vo; 2 | 3 | import com.mvc.ethereum.utils.CoinUtil; 4 | import lombok.Data; 5 | 6 | import java.math.BigInteger; 7 | 8 | /** 9 | * LockCount 10 | * 11 | * @author qiyichen 12 | * @create 2018/1/16 11:27 13 | */ 14 | @Data 15 | public class LockCount { 16 | 17 | private BigInteger allBalance; 18 | private BigInteger nowBalance; 19 | private BigInteger unlockBalance; 20 | private BigInteger allInterest; 21 | private BigInteger nowInterest; 22 | private BigInteger unlockInterest; 23 | private Integer allNum; 24 | private Integer nowNum; 25 | private Integer unlockNum; 26 | private BigInteger coinId; 27 | 28 | 29 | public Double getAllBalanceStr() { 30 | return CoinUtil.wei2Value(coinId, allBalance); 31 | } 32 | 33 | public Double getNowBalanceStr() { 34 | return CoinUtil.wei2Value(coinId, nowBalance); 35 | } 36 | 37 | public Double getUnlockBalanceStr() { 38 | return CoinUtil.wei2Value(coinId, unlockBalance); 39 | } 40 | 41 | public Double getAllInterestStr() { 42 | return CoinUtil.wei2Value(coinId, allInterest); 43 | } 44 | 45 | public Double getNowInterestStr() { 46 | return CoinUtil.wei2Value(coinId, nowInterest); 47 | } 48 | 49 | public Double getUnlockInterestStr() { 50 | return CoinUtil.wei2Value(coinId, unlockInterest); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /mvc-api/src/main/java/com/mvc/api/vo/authority/PermissionInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.api.vo.authority; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * ${DESCRIPTION} 7 | * 8 | * @author wanghaobin 9 | * @create 2017-06-22 15:19 10 | */ 11 | public class PermissionInfo implements Serializable{ 12 | private String code; 13 | private String type; 14 | private String uri; 15 | private String method; 16 | private String name; 17 | private String menu; 18 | 19 | public String getMenu() { 20 | return menu; 21 | } 22 | 23 | public void setMenu(String menu) { 24 | this.menu = menu; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | 36 | 37 | public String getMethod() { 38 | return method; 39 | } 40 | 41 | public void setMethod(String method) { 42 | this.method = method; 43 | } 44 | 45 | public String getCode() { 46 | return code; 47 | } 48 | 49 | public void setCode(String code) { 50 | this.code = code; 51 | } 52 | 53 | public String getType() { 54 | return type; 55 | } 56 | 57 | public void setType(String type) { 58 | this.type = type; 59 | } 60 | 61 | public String getUri() { 62 | return uri; 63 | } 64 | 65 | public void setUri(String uri) { 66 | this.uri = uri; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/service/CapitalService.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.service; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.mvc.common.biz.BaseBiz; 5 | import com.mvc.console.entity.Capital; 6 | import com.mvc.console.mapper.CapitalMapper; 7 | import com.mvc.console.vo.CapitalVO; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.math.BigInteger; 13 | import java.util.List; 14 | 15 | /** 16 | * ${DESCRIPTION} 17 | * 18 | * @author wanghaobin 19 | * @create 2017-06-08 16:23 20 | */ 21 | @Service 22 | @Transactional(rollbackFor = Exception.class) 23 | public class CapitalService extends BaseBiz { 24 | 25 | @Autowired 26 | private CapitalMapper capitalMapper; 27 | 28 | public List selectByUserId(Capital capital ) { 29 | PageHelper.startPage(0, 10); 30 | List page = capitalMapper.selectByUserId(capital.getUserId()); 31 | return page; 32 | } 33 | 34 | public void updateValue(BigInteger quantity, BigInteger userId, BigInteger coinId, BigInteger interest) { 35 | capitalMapper.updateValue(quantity, userId, coinId, interest); 36 | } 37 | 38 | public void updateBalance(BigInteger coinId, BigInteger userId, BigInteger value) { 39 | capitalMapper.updateBalance(coinId, userId, value); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/config/MapperConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config; 2 | 3 | 4 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 5 | import org.springframework.boot.bind.RelaxedPropertyResolver; 6 | import org.springframework.context.EnvironmentAware; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.core.env.Environment; 10 | import tk.mybatis.spring.mapper.MapperScannerConfigurer; 11 | 12 | /** 13 | * 扫描配置类 14 | * 15 | * @author qyc 16 | */ 17 | @Configuration 18 | @AutoConfigureAfter(MybatisConfiguration.class) 19 | public class MapperConfiguration implements EnvironmentAware { 20 | 21 | private RelaxedPropertyResolver propertyResolver; 22 | 23 | private String basePackage; 24 | 25 | @Bean 26 | public MapperScannerConfigurer mapperScannerConfigurer(Environment environment) { 27 | 28 | MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); 29 | mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory"); 30 | mapperScannerConfigurer.setBasePackage(basePackage); 31 | return mapperScannerConfigurer; 32 | } 33 | 34 | 35 | @Override 36 | public void setEnvironment(Environment environment) { 37 | this.propertyResolver = new RelaxedPropertyResolver(environment, null); 38 | this.basePackage = propertyResolver.getProperty("mybatis.basepackage"); 39 | } 40 | } -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/bean/ClientInfo.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.bean; 2 | 3 | 4 | import com.mvc.auth.common.util.jwt.IJWTInfo; 5 | 6 | /** 7 | * @author qyc 8 | */ 9 | public class ClientInfo implements IJWTInfo { 10 | String clientId; 11 | String name; 12 | String address; 13 | 14 | public ClientInfo(String clientId, String name, String id) { 15 | this.clientId = clientId; 16 | this.name = name; 17 | this.id = id; 18 | } 19 | 20 | public ClientInfo(String clientId, String name, String id, String address) { 21 | this.clientId = clientId; 22 | this.name = name; 23 | this.id = id; 24 | this.address = address; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | String id; 32 | 33 | public String getClientId() { 34 | return clientId; 35 | } 36 | 37 | public void setClientId(String clientId) { 38 | this.clientId = clientId; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | @Override 46 | public String getUniqueName() { 47 | return clientId; 48 | } 49 | 50 | @Override 51 | public String getId() { 52 | return id; 53 | } 54 | 55 | @Override 56 | public String getName() { 57 | return name; 58 | } 59 | 60 | @Override 61 | public String getAddress() { 62 | return address; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /mvc-admin/src/main/java/com/mvc/user/rpc/UserRest.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.rpc; 2 | 3 | import com.ace.cache.annotation.Cache; 4 | import com.mvc.api.vo.authority.PermissionInfo; 5 | import com.mvc.api.vo.user.UserInfo; 6 | import com.mvc.user.rpc.service.PermissionService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author qyc 14 | * @create 2017-06-21 8:15 15 | */ 16 | @RestController 17 | @RequestMapping("api") 18 | public class UserRest { 19 | @Autowired 20 | private PermissionService permissionService; 21 | 22 | @Cache(key = "permission") 23 | @RequestMapping(value = "/permissions", method = RequestMethod.GET) 24 | public @ResponseBody 25 | List getAllPermission() { 26 | return permissionService.getAllPermission(); 27 | } 28 | 29 | @Cache(key = "permission:u{1}") 30 | @RequestMapping(value = "/user/un/{username}/permissions", method = RequestMethod.GET) 31 | public @ResponseBody 32 | List getPermissionByUsername(@PathVariable("username") String username) { 33 | return permissionService.getPermissionByUsername(username); 34 | } 35 | 36 | @RequestMapping(value = "/user/validate", method = RequestMethod.POST) 37 | public @ResponseBody 38 | UserInfo validate(String username, String password) { 39 | return permissionService.validate(username, password); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-server/src/main/java/com/mvc/gate/config/UserPrincipal.java: -------------------------------------------------------------------------------- 1 | package com.mvc.gate.config; 2 | 3 | import com.mvc.auth.client.config.UserAuthConfig; 4 | import com.mvc.auth.client.jwt.UserAuthUtil; 5 | import com.mvc.auth.common.util.jwt.IJWTInfo; 6 | import com.mvc.gate.ratelimit.config.IUserPrincipal; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.util.StringUtils; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | /** 13 | * @author qyc 14 | */ 15 | public class UserPrincipal implements IUserPrincipal { 16 | 17 | @Autowired 18 | private UserAuthConfig userAuthConfig; 19 | @Autowired 20 | private UserAuthUtil userAuthUtil; 21 | 22 | @Override 23 | public String getName(HttpServletRequest request) { 24 | IJWTInfo infoFromToken = getJwtInfo(request); 25 | return infoFromToken == null ? null : infoFromToken.getUniqueName(); 26 | } 27 | 28 | private IJWTInfo getJwtInfo(HttpServletRequest request) { 29 | IJWTInfo infoFromToken = null; 30 | try { 31 | String authToken = request.getHeader(userAuthConfig.getTokenHeader()); 32 | if (StringUtils.isEmpty(authToken)) { 33 | infoFromToken = null; 34 | } else { 35 | infoFromToken = userAuthUtil.getInfoFromToken(authToken); 36 | } 37 | } catch (Exception e) { 38 | infoFromToken = null; 39 | } 40 | return infoFromToken; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /mvc-gate/mvc-gate-ratelimit/src/main/java/com/mvc/gate/ratelimit/config/repository/InMemoryRateLimiter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.mvc.gate.ratelimit.config.repository; 18 | 19 | import com.mvc.gate.ratelimit.config.Rate; 20 | 21 | import java.util.Map; 22 | import java.util.concurrent.ConcurrentHashMap; 23 | 24 | /** 25 | * In memory rate limiter configuration for dev environment. 26 | * 27 | * @author Marcos Barbero 28 | * @since 2017-06-23 29 | */ 30 | public class InMemoryRateLimiter extends AbstractRateLimiter { 31 | 32 | private Map repository = new ConcurrentHashMap<>(); 33 | 34 | @Override 35 | protected Rate getRate(String key) { 36 | return this.repository.get(key); 37 | } 38 | 39 | @Override 40 | protected void saveRate(Rate rate) { 41 | this.repository.put(rate.getKey(), rate); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.mapper; 2 | 3 | import com.mvc.user.dto.UserDTO; 4 | import com.mvc.user.entity.User; 5 | import com.mvc.user.vo.UserVO; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | import tk.mybatis.mapper.common.Mapper; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author qyc 14 | */ 15 | public interface UserMapper extends Mapper { 16 | /** 17 | * selectUserByPwd 18 | * 19 | * @param user 20 | * @return 21 | */ 22 | @Select("select * from user where cellphone=#{cellphone} and password=#{password}") 23 | User selectUserByPwd(User user); 24 | 25 | /** 26 | * selectUserByPhone 27 | * 28 | * @param user 29 | * @return 30 | */ 31 | @Select("select * from user where cellphone=#{cellphone}") 32 | User selectUserByPhone(UserDTO user); 33 | 34 | /** 35 | * list 36 | * 37 | * @return 38 | */ 39 | @Select({""}) 46 | List list(@Param("cellphone") String cellphone); 47 | 48 | /** 49 | * selectNullAddr 50 | * 51 | * @return 52 | */ 53 | @Select("SELECT * FROM user WHERE address_eth is null") 54 | List selectNullAddr(); 55 | } -------------------------------------------------------------------------------- /mvc-sms/src/main/java/com/mvc/sms/config/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.sms.config; 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.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 11 | 12 | /** 13 | * ${DESCRIPTION} 14 | * 15 | * @author wanghaobin 16 | * @create 2017-06-21 8:39 17 | */ 18 | 19 | @Configuration 20 | public class RedisConfiguration { 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 24 | RedisTemplate template = new RedisTemplate(); 25 | template.setConnectionFactory(factory); 26 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 27 | ObjectMapper om = new ObjectMapper(); 28 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 29 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 30 | jackson2JsonRedisSerializer.setObjectMapper(om); 31 | template.setValueSerializer(jackson2JsonRedisSerializer); 32 | template.afterPropertiesSet(); 33 | return template; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/UserBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user; 2 | 3 | import com.ace.cache.EnableAceCache; 4 | import com.mvc.auth.client.EnableAceAuthClient; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.builder.SpringApplicationBuilder; 8 | import org.springframework.boot.web.servlet.ServletComponentScan; 9 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 10 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 11 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 12 | import org.springframework.scheduling.annotation.EnableAsync; 13 | import org.springframework.scheduling.annotation.EnableScheduling; 14 | import org.springframework.transaction.annotation.EnableTransactionManagement; 15 | 16 | /** 17 | * ${DESCRIPTION} 18 | * 19 | * @author wanghaobin 20 | * @create 2017-05-25 12:44 21 | */ 22 | @EnableEurekaClient 23 | @EnableCircuitBreaker 24 | @SpringBootApplication 25 | @EnableFeignClients({"com.mvc.user.rpc.service", "com.mvc.auth.client.feign"}) 26 | @EnableScheduling 27 | @EnableAceAuthClient 28 | @ServletComponentScan({"com.mvc.user.config.druid", "com.mvc.user.service"}) 29 | @EnableAutoConfiguration 30 | @EnableAsync 31 | @EnableTransactionManagement 32 | public class UserBootstrap { 33 | public static void main(String[] args) { 34 | new SpringApplicationBuilder(UserBootstrap.class).web(true).run(args); } 35 | } 36 | -------------------------------------------------------------------------------- /mvc-admin-console/src/main/java/com/mvc/console/config/MapperConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config; 2 | 3 | 4 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 5 | import org.springframework.boot.bind.RelaxedPropertyResolver; 6 | import org.springframework.context.EnvironmentAware; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.core.env.Environment; 10 | import tk.mybatis.spring.mapper.MapperScannerConfigurer; 11 | 12 | /** 13 | * @author qyc 14 | * @date 2016年12月15日 15 | * @since 1.7 16 | */ 17 | @Configuration 18 | @AutoConfigureAfter(MybatisConfiguration.class) 19 | public class MapperConfiguration implements EnvironmentAware { 20 | 21 | private RelaxedPropertyResolver propertyResolver; 22 | 23 | private String basePackage; 24 | 25 | @Bean 26 | public MapperScannerConfigurer mapperScannerConfigurer(Environment environment) { 27 | 28 | MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer(); 29 | mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory"); 30 | mapperScannerConfigurer.setBasePackage(basePackage); 31 | return mapperScannerConfigurer; 32 | } 33 | 34 | 35 | @Override 36 | public void setEnvironment(Environment environment) { 37 | this.propertyResolver = new RelaxedPropertyResolver(environment, null); 38 | this.basePackage = propertyResolver.getProperty("mybatis.basepackage"); 39 | } 40 | } -------------------------------------------------------------------------------- /mvc-user/src/main/java/com/mvc/user/config/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.user.config; 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.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 11 | 12 | /** 13 | * ${DESCRIPTION} 14 | * 15 | * @author wanghaobin 16 | * @create 2017-06-21 8:39 17 | */ 18 | 19 | @Configuration 20 | public class RedisConfiguration { 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 24 | RedisTemplate template = new RedisTemplate(); 25 | template.setConnectionFactory(factory); 26 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 27 | ObjectMapper om = new ObjectMapper(); 28 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 29 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 30 | jackson2JsonRedisSerializer.setObjectMapper(om); 31 | template.setValueSerializer(jackson2JsonRedisSerializer); 32 | template.afterPropertiesSet(); 33 | return template; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mvc-console/src/main/java/com/mvc/console/config/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.console.config; 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.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 11 | 12 | /** 13 | * ${DESCRIPTION} 14 | * 15 | * @author wanghaobin 16 | * @create 2017-06-21 8:39 17 | */ 18 | 19 | @Configuration 20 | public class RedisConfiguration { 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 24 | RedisTemplate template = new RedisTemplate(); 25 | template.setConnectionFactory(factory); 26 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 27 | ObjectMapper om = new ObjectMapper(); 28 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 29 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 30 | jackson2JsonRedisSerializer.setObjectMapper(om); 31 | template.setValueSerializer(jackson2JsonRedisSerializer); 32 | template.afterPropertiesSet(); 33 | return template; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/configuration/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.configuration; 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.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 11 | 12 | /** 13 | * ${DESCRIPTION} 14 | * 15 | * @author wanghaobin 16 | * @create 2017-06-21 8:39 17 | */ 18 | 19 | @Configuration 20 | public class RedisConfiguration { 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 24 | RedisTemplate template = new RedisTemplate(); 25 | template.setConnectionFactory(factory); 26 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 27 | ObjectMapper om = new ObjectMapper(); 28 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 29 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 30 | jackson2JsonRedisSerializer.setObjectMapper(om); 31 | template.setValueSerializer(jackson2JsonRedisSerializer); 32 | template.afterPropertiesSet(); 33 | return template; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mvc-ethereum/src/main/java/com/mvc/ethereum/utils/EthereumUtil.java: -------------------------------------------------------------------------------- 1 | package com.mvc.ethereum.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStream; 5 | import java.io.InputStreamReader; 6 | import java.math.BigInteger; 7 | import java.util.stream.Collectors; 8 | 9 | /** 10 | * @author qyc 11 | */ 12 | public class EthereumUtil { 13 | 14 | public static String adapt(final String content) { 15 | return content.replace("\n", "").replace("\r", ""); 16 | } 17 | 18 | public static String removeLineBreaksFromFile(final String file, final Class clazz) { 19 | InputStream stream = clazz.getClassLoader().getResourceAsStream(file); 20 | BufferedReader buffer = new BufferedReader(new InputStreamReader(stream)); 21 | String collect = buffer.lines().collect(Collectors.joining("\n")); 22 | return collect.replace("\n", "").replace("\r", ""); 23 | } 24 | 25 | public static String adapt(final String content, final int arguments) { 26 | String collect = content.replace("\n", "") 27 | .replaceAll("\\{", "'{'").replaceAll("\\}", "'}'"); 28 | for (int i = 0; i < arguments; i++) { 29 | collect = collect.replaceAll("'\\{'" + i + "'\\}'", "\\{" + i + "\\}"); 30 | } 31 | return collect.replaceAll("''", ""); 32 | } 33 | 34 | public static Long decryptQuantity(String quantity) { 35 | BigInteger latestBalance = new BigInteger( 36 | "00" + quantity.substring(2), 16); 37 | return latestBalance.longValue(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /mvc-auth/mvc-auth-server/src/main/java/com/mvc/auth/configuration/RedisConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mvc.auth.configuration; 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.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.redis.connection.RedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 11 | 12 | /** 13 | * ${DESCRIPTION} 14 | * 15 | * @author wanghaobin 16 | * @create 2017-06-21 8:39 17 | */ 18 | 19 | @Configuration 20 | public class RedisConfiguration { 21 | 22 | @Bean 23 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 24 | RedisTemplate template = new RedisTemplate(); 25 | template.setConnectionFactory(factory); 26 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 27 | ObjectMapper om = new ObjectMapper(); 28 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 29 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 30 | jackson2JsonRedisSerializer.setObjectMapper(om); 31 | template.setValueSerializer(jackson2JsonRedisSerializer); 32 | template.afterPropertiesSet(); 33 | return template; 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------