master
enoch 4 years ago
commit 245d318152
  1. 4
      .gitignore
  2. 103
      build.gradle
  3. 3
      settings.gradle
  4. 2
      sliyun-app/build.gradle
  5. BIN
      sliyun-app/gradle/wrapper/gradle-wrapper.jar
  6. 5
      sliyun-app/gradle/wrapper/gradle-wrapper.properties
  7. 1
      sliyun-app/settings.gradle
  8. 25
      sliyun-app/src/main/java/com/aopcloud/beam/app/BeamAppApplication.java
  9. 118
      sliyun-app/src/main/java/com/aopcloud/beam/app/CodeGenerator.java
  10. 55
      sliyun-app/src/main/java/com/aopcloud/beam/app/Interceptor/ApiSignInterceptor.java
  11. 54
      sliyun-app/src/main/java/com/aopcloud/beam/app/Interceptor/AuthorityInterceptor.java
  12. 56
      sliyun-app/src/main/java/com/aopcloud/beam/app/Interceptor/LogcatInterceptor.java
  13. 98
      sliyun-app/src/main/java/com/aopcloud/beam/app/Interceptor/UserLoginInterceptor.java
  14. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/annotion/LoginRequired.java
  15. 24
      sliyun-app/src/main/java/com/aopcloud/beam/app/annotion/Permission.java
  16. 41
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/controller/AdItemController.java
  17. 41
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/controller/AdPositionController.java
  18. 52
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/entity/Ad.java
  19. 53
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/entity/AdEntity.java
  20. 177
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/entity/AdItem.java
  21. 95
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/entity/AdPosition.java
  22. 175
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/entity/Item.java
  23. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/mapper/AdItemMapper.java
  24. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/mapper/AdMapper.java
  25. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/mapper/AdPositionMapper.java
  26. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/mapper/ItemMapper.java
  27. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/IAdItemService.java
  28. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/IAdPositionService.java
  29. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/IAdService.java
  30. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/IItemService.java
  31. 55
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/impl/AdItemServiceImpl.java
  32. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/impl/AdPositionServiceImpl.java
  33. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/impl/AdServiceImpl.java
  34. 56
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/ad/service/impl/ItemServiceImpl.java
  35. 41
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/controller/AppController.java
  36. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/controller/HomeCoinController.java
  37. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/controller/HomeNoticeController.java
  38. 52
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/Banner.java
  39. 17
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/HomeBean.java
  40. 147
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/HomeCoin.java
  41. 102
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/HomeCoinBean.java
  42. 167
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/HomeNotice.java
  43. 58
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/entity/NoticeBean.java
  44. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/mapper/HomeCoinMapper.java
  45. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/mapper/HomeNoticeMapper.java
  46. 4
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/IAppService.java
  47. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/IHomeCoinService.java
  48. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/IHomeNoticeService.java
  49. 45
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/impl/AppServiceImpl.java
  50. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/impl/HomeCoinServiceImpl.java
  51. 34
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/app/service/impl/HomeNoticeServiceImpl.java
  52. 86
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/controller/CoinController.java
  53. 46
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/controller/CoinPackageController.java
  54. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/controller/CoinPackageUnitController.java
  55. 192
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/entity/Coin.java
  56. 56
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/entity/CoinAction.java
  57. 175
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/entity/CoinPackage.java
  58. 94
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/entity/CoinPackageUnit.java
  59. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/mapper/CoinMapper.java
  60. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/mapper/CoinPackageMapper.java
  61. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/mapper/CoinPackageUnitMapper.java
  62. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/ICoinPackageService.java
  63. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/ICoinPackageUnitService.java
  64. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/ICoinService.java
  65. 46
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/impl/CoinPackageServiceImpl.java
  66. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/impl/CoinPackageUnitServiceImpl.java
  67. 70
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/coin/service/impl/CoinServiceImpl.java
  68. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/img/controller/BeamImgController.java
  69. 61
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/img/entity/BeamImg.java
  70. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/img/mapper/BeamImgMapper.java
  71. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/img/service/IBeamImgService.java
  72. 20
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/img/service/impl/BeamImgServiceImpl.java
  73. 50
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberCoinAddressController.java
  74. 38
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberCoinRecordController.java
  75. 80
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberController.java
  76. 19
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberLevelController.java
  77. 19
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberLoginLogController.java
  78. 19
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/controller/MemberStatisticsInfoController.java
  79. 14
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/AddCoinAddress.java
  80. 278
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/Member.java
  81. 65
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberActionBean.java
  82. 165
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberCoinAddress.java
  83. 217
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberCoinRecord.java
  84. 161
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberLevel.java
  85. 119
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberLoginLog.java
  86. 142
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/entity/MemberStatisticsInfo.java
  87. 34
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberCoinAddressMapper.java
  88. 26
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberCoinRecordMapper.java
  89. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberLevelMapper.java
  90. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberLoginLogMapper.java
  91. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberMapper.java
  92. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/mapper/MemberStatisticsInfoMapper.java
  93. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberCoinAddressService.java
  94. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberCoinRecordService.java
  95. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberLevelService.java
  96. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberLoginLogService.java
  97. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberService.java
  98. 16
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/IMemberStatisticsInfoService.java
  99. 70
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/impl/MemberCoinAddressServiceImpl.java
  100. 35
      sliyun-app/src/main/java/com/aopcloud/beam/app/api/member/service/impl/MemberCoinRecordServiceImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

4
.gitignore vendored

@ -0,0 +1,4 @@
/.gradle
/.idea
/build
/sliyun-app/build

@ -0,0 +1,103 @@
//gradle脚本自身需要使用的资源,
buildscript {
ext {
springBootVersion = '2.2.4.RELEASE'
}
repositories {
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'https://maven.aliyun.com/repository/spring/' }
jcenter()
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
// java编译的时候缺省状态下会因为中文字符而失败
}
//allprojects
allprojects {
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'java-library'
version = '1.0'
sourceCompatibility = 8
targetCompatibility = 8
}
// subprojects :
subprojects {
apply plugin: 'java'
apply plugin: 'org.springframework.boot' //使springboot插件
apply plugin: 'io.spring.dependency-management' //
// java编译的时候缺省状态下会因为中文字符而失败
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
//
repositories {
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'https://maven.aliyun.com/repository/spring/' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://oss.sonatype.org/content/repositories/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
jcenter()
mavenCentral()
}
//
dependencies {
implementation fileTree(dir: 'libs', includes: ['*.jar'])
implementation 'org.codehaus.groovy:groovy-all:2.3.11'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile 'org.springframework.boot:spring-boot-devtools:2.1.14.RELEASE'
//jdbc
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
//alibaba druid
implementation 'com.alibaba:druid-spring-boot-starter:1.2.4'
//jdbc
implementation 'mysql:mysql-connector-java:8.0.22'
//mail
implementation 'org.springframework.boot:spring-boot-starter-mail'
//Jwt
implementation 'com.auth0:java-jwt:3.12.0'
//fastjson
implementation 'com.alibaba:fastjson:1.2.47'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
//freemarker
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
//mybatis-plus
implementation 'com.baomidou:mybatis-plus-boot-starter:3.4.2'
//mybatis-plus-generator
implementation 'com.baomidou:mybatis-plus-generator:3.3.2'
//lombok
implementation 'org.projectlombok:lombok:1.18.12'
// commons
implementation 'commons-lang:commons-lang:2.6'
//aop log
implementation 'org.springframework.boot:spring-boot-starter-aop:2.4.2'
// OSS
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.10.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'org.bitcoinj:bitcoinj-core:0.14.7'
compile 'org.apache.httpcomponents:httpclient:4.5.6'
compile 'org.apache.httpcomponents:httpcore:4.4.14'
}
}
//
//// jar
//bootJar {
//// archiveBaseName = 'aaa' //aaa-0.0.1-SNAPSHOT.jar
// archiveFileName = 'coin.jar' //
//}

@ -0,0 +1,3 @@
rootProject.name = 'sliyun-app'
include ':sliyun-app'

@ -0,0 +1,2 @@
dependencies {
}

Binary file not shown.

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@ -0,0 +1 @@
rootProject.name = 'beam-app'

@ -0,0 +1,25 @@
package com.aopcloud.beam.app;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@SpringBootApplication
@MapperScan(basePackages = "com.aopcloud.beam.app.api.*")
public class BeamAppApplication {
public static void main(String[] args) {
SpringApplication.run(BeamAppApplication.class, args);
}
// @Bean
// public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
//
// PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer();
//
// c.setIgnoreUnresolvablePlaceholders(true);
//
// return c;
// }
}

@ -0,0 +1,118 @@
package com.aopcloud.beam.app;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
import com.baomidou.mybatisplus.generator.config.rules.FileType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class CodeGenerator {
private static String pack = "com.aopcloud.beam.app";
private static String parent = pack+".api";
private static String moduleName = "beam-app";
private static String projectPath = System.getProperty("user.dir") + "/" + moduleName;
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotBlank(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
// String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java/");
// gc.setOutputDir(projectPath);
gc.setAuthor("Enoch");
gc.setOpen(false);
gc.setIdType(IdType.AUTO);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://rm-wz99smt6zjv8tt10x1250109m.mysql.rds.aliyuncs.com:3306/sliyun?characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("live_solution");
dsc.setPassword("Nf46KD8MCTN3jWKZ");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setModuleName(scanner("模块名"));
pc.setParent(parent);
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(false);
strategy.setRestControllerStyle(true);
// 公共父类
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
// strategy.setSuperEntityColumns("id");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix("sys_","sly_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}

@ -0,0 +1,55 @@
package com.aopcloud.beam.app.Interceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class ApiSignInterceptor implements HandlerInterceptor {
/**
* 请求前
*
* @param request
* @param response
* @param handler controllerHandler 对象
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return false;
}
/**
* 请求后 , 无抛出异常时
*
* @param request
* @param response
* @param handler
* @param modelAndView
* @throws Exception
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
/**
* 请求后,无论是否抛出异常 , 均执行
* 注意 controlleradvice的执行是在该方法之前的.对exception进行处理过. 该方法接收不到该异常
* 会拦截所有的controller,包括spring提供的controller , 如baseerrorcontroller 异常处理handler
* @param request
* @param response
* @param handler
* @param ex
* @throws Exception
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}

@ -0,0 +1,54 @@
package com.aopcloud.beam.app.Interceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class AuthorityInterceptor implements HandlerInterceptor {
/**
* 请求前
*
* @param request
* @param response
* @param handler controllerHandler 对象
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return false;
}
/**
* 请求后 , 无抛出异常时
*
* @param request
* @param response
* @param handler
* @param modelAndView
* @throws Exception
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
/**
* 请求后,无论是否抛出异常 , 均执行
* 注意 controlleradvice的执行是在该方法之前的.对exception进行处理过. 该方法接收不到该异常
* 会拦截所有的controller,包括spring提供的controller , 如baseerrorcontroller 异常处理handler
* @param request
* @param response
* @param handler
* @param ex
* @throws Exception
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}

@ -0,0 +1,56 @@
package com.aopcloud.beam.app.Interceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class LogcatInterceptor implements HandlerInterceptor {
/**
* 请求前
*
* @param request
* @param response
* @param handler controllerHandler 对象
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return false;
}
/**
* 请求后 , 无抛出异常时
*
* @param request
* @param response
* @param handler
* @param modelAndView
* @throws Exception
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
/**
* 请求后,无论是否抛出异常 , 均执行
* 注意 controlleradvice的执行是在该方法之前的.对exception进行处理过. 该方法接收不到该异常
* 会拦截所有的controller,包括spring提供的controller , 如baseerrorcontroller 异常处理handler
* @param request
* @param response
* @param handler
* @param ex
* @throws Exception
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}

@ -0,0 +1,98 @@
package com.aopcloud.beam.app.Interceptor;
import com.alibaba.fastjson.JSON;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.aopcloud.beam.app.api.member.service.impl.MemberServiceImpl;
import com.aopcloud.beam.app.annotion.LoginRequired;
import com.aopcloud.beam.app.core.AppException;;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;
@Component
public class UserLoginInterceptor implements HandlerInterceptor {
@Resource
private MemberServiceImpl userService;
public static UserLoginInterceptor articlesReceiver; //关键2
@PostConstruct //关键3
public void init() {
articlesReceiver = this;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
String token = "";
if (StringUtils.isBlank(token)) {
// 2.从headers中获取
token = request.getHeader("token");
}
if (StringUtils.isBlank(token)) {
// 3.从请求参数获取
token = request.getParameter("token");
}
if (!(handler instanceof HandlerMethod)) {
return true;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
if (method.isAnnotationPresent(LoginRequired.class)) {
if (!StringUtils.isEmpty(token)) {
Member user = articlesReceiver.userService.getMemberByToken(token);
if (user == null || !user.getToken().equals(token)) {
throw new AppException("token 无效");
} else {
return true;
}
}
throw new AppException("token 无效");
}
return true;
}
private void result(HttpServletResponse response, Result result) {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
response.setStatus(200);
PrintWriter out = null;
try {
out = response.getWriter();
out.append(JSON.toJSONString(result));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null)
out.close();
}
}
private String getTokenFromCookie(HttpServletRequest request) {
String token = null;
Cookie[] cookies = request.getCookies();
int len = null == cookies ? 0 : cookies.length;
if (len > 0) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("token")) {
token = cookie.getValue();
break;
}
}
}
return token;
}
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.annotion;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface LoginRequired {
/**
* 是否需要登录
*/
boolean required() default true;
}

@ -0,0 +1,24 @@
package com.aopcloud.beam.app.annotion;
import java.lang.annotation.*;
/**
* 权限注解 用于检查权限 规定访问权限
*
* @example @Permission({role1,role2})
* @example @Permission
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface Permission {
/**
* <p>角色英文名称</p>
* <p>使用注解时加上这个值表示限制只有某个角色的才可以访问对应的资源</p>
* <p>常用在某些资源限制只有超级管理员角色才可访问</p>
*/
String[] value() default {};
}

@ -0,0 +1,41 @@
package com.aopcloud.beam.app.api.ad.controller;
import com.aopcloud.beam.app.api.ad.entity.AdEntity;
import com.aopcloud.beam.app.api.ad.service.impl.AdItemServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* <p>
* 广告表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/ad")
public class AdItemController {
@Resource
private AdItemServiceImpl itemService;
@PostMapping("/create")
public Result create(@RequestBody AdEntity entity) {
return itemService.create(entity);
}
@GetMapping("/list")
public Result list() {
return itemService.getAll();
}
@PostMapping("/delete")
public Result delete(int id) {
return itemService.delete(id);
}
}

@ -0,0 +1,41 @@
package com.aopcloud.beam.app.api.ad.controller;
import com.aopcloud.beam.app.api.ad.entity.AdEntity;
import com.aopcloud.beam.app.api.ad.service.impl.AdItemServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* <p>
* 广告位表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/ad/position")
public class AdPositionController {
@Resource
private AdItemServiceImpl itemService;
@PostMapping("/create")
public Result create(@RequestBody AdEntity entity) {
return itemService.create(entity);
}
@GetMapping("/list")
public Result list() {
return itemService.getAll();
}
@PostMapping("/delete")
public Result delete(int id) {
return itemService.delete(id);
}
}

@ -0,0 +1,52 @@
package com.aopcloud.beam.app.api.ad.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* Banner表格
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class Ad implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* banner 名称广告位名称
*/
private String name;
/**
* banner 描述
*/
private String description;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

@ -0,0 +1,53 @@
package com.aopcloud.beam.app.api.ad.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AdEntity {
@Min(value = 1,message = "广告位ID不能为空")
public int adId;
@NotBlank(message = "广告位事件类型不能为空")
public String eventType;
@NotBlank(message = "广告位事件不能为空")
public String event;
@NotBlank(message = "广告位封面不能为空")
public String img;
public int getAdId() {
return adId;
}
public void setAdId(int adId) {
this.adId = adId;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}

@ -0,0 +1,177 @@
package com.aopcloud.beam.app.api.ad.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* <p>
* 广告表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_ad_item")
public class AdItem implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 广告位ID id
*/
private Integer adId;
/**
* imgage id
*/
@JsonIgnore
private String imgOssFile;
/**
* 广告事件
*/
private String actionEvent;
/**
* 广告事件类型
*/
private String actionType;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
@JsonIgnore
private LocalDateTime updateTime;
@TableField(exist = false)
private String imgUrl;
@TableField(exist = false)
private String adPosition = "App 首页Banner";
@TableField(exist = false)
private String eventName = "链接跳转";
@TableField(exist = false)
private String time ;
public void setTime(String time) {
this.time = time;
}
public String getTime() {
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return dtf2.format(createTime);
}
public String getImgUrl() {
return AliyunOSSUtil.getInstance().getFileUrl(imgOssFile);
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getAdPosition() {
return adPosition;
}
public void setAdPosition(String adPosition) {
this.adPosition = adPosition;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAdId() {
return adId;
}
public void setAdId(Integer adId) {
this.adId = adId;
}
public String getImgOssFile() {
return imgOssFile;
}
public void setImgOssFile(String imgOssFile) {
this.imgOssFile = imgOssFile;
}
public String getActionEvent() {
return actionEvent;
}
public void setActionEvent(String actionEvent) {
this.actionEvent = actionEvent;
}
public String getActionType() {
return actionType;
}
public void setActionType(String actionType) {
this.actionType = actionType;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "AdItem{" +
"id=" + id +
", adId=" + adId +
", imgOssFile=" + imgOssFile +
", actionEvent=" + actionEvent +
", actionType=" + actionType +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,95 @@
package com.aopcloud.beam.app.api.ad.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 广告位表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_ad_position")
public class AdPosition implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 广告位名称
*/
private String name;
/**
* 广告位名称
*/
private String description;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "AdPosition{" +
"id=" + id +
", name=" + name +
", description=" + description +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,175 @@
package com.aopcloud.beam.app.api.ad.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* <p>
* Banner item 表格
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("ad_item")
public class Item implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* banner id
*/
private Integer adId;
/**
* image
*/
@JsonIgnore
private String ossFileName;
/**
* event
*/
private String actionEvent;
/**
* 类型
*/
private String actionType;
/**
* 创建时间
*/
@JsonIgnore
private LocalDateTime createTime;
/**
* 更新时间
*/
@JsonIgnore
private LocalDateTime updateTime;
@TableField(exist = false)
private String imgUrl;
@TableField(exist = false)
private String adPosition = "App 首页Banner";
@TableField(exist = false)
private String eventName = "链接跳转";
@TableField(exist = false)
private String time ;
public void setTime(String time) {
this.time = time;
}
public String getTime() {
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return dtf2.format(createTime);
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAdId() {
return adId;
}
public void setAdId(Integer adId) {
this.adId = adId;
}
public String getOssFileName() {
return ossFileName;
}
public void setOssFileName(String ossFileName) {
this.ossFileName = ossFileName;
}
public String getActionEvent() {
return actionEvent;
}
public void setActionEvent(String actionEvent) {
this.actionEvent = actionEvent;
}
public String getActionType() {
return actionType;
}
public void setActionType(String actionType) {
this.actionType = actionType;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getImgUrl() {
return AliyunOSSUtil.getInstance().getFileUrl(ossFileName);
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getAdPosition() {
return adPosition;
}
public void setAdPosition(String adPosition) {
this.adPosition = adPosition;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.mapper;
import com.aopcloud.beam.app.api.ad.entity.AdItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 广告表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface AdItemMapper extends BaseMapper<AdItem> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.mapper;
import com.aopcloud.beam.app.api.ad.entity.Ad;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Banner表格 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
public interface AdMapper extends BaseMapper<Ad> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.mapper;
import com.aopcloud.beam.app.api.ad.entity.AdPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 广告位表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface AdPositionMapper extends BaseMapper<AdPosition> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.mapper;
import com.aopcloud.beam.app.api.ad.entity.Item;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Banner item 表格 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
public interface ItemMapper extends BaseMapper<Item> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.service;
import com.aopcloud.beam.app.api.ad.entity.AdItem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 广告表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IAdItemService extends IService<AdItem> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.service;
import com.aopcloud.beam.app.api.ad.entity.AdPosition;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 广告位表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IAdPositionService extends IService<AdPosition> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.service;
import com.aopcloud.beam.app.api.ad.entity.Ad;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* Banner表格 服务类
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
public interface IAdService extends IService<Ad> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.ad.service;
import com.aopcloud.beam.app.api.ad.entity.Item;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* Banner item 表格 服务类
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
public interface IItemService extends IService<Item> {
}

@ -0,0 +1,55 @@
package com.aopcloud.beam.app.api.ad.service.impl;
import com.aopcloud.beam.app.api.ad.entity.AdEntity;
import com.aopcloud.beam.app.api.ad.entity.AdItem;
import com.aopcloud.beam.app.api.ad.mapper.AdItemMapper;
import com.aopcloud.beam.app.api.ad.service.IAdItemService;
import com.aopcloud.beam.app.core.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 广告表 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@Service
public class AdItemServiceImpl extends ServiceImpl<AdItemMapper, AdItem> implements IAdItemService {
public Result create(AdEntity adEntity) {
AdItem item = new AdItem();
item.setAdId(adEntity.adId);
item.setActionType(adEntity.eventType);
item.setActionEvent(adEntity.event);
item.setImgOssFile(adEntity.getImg());
item.setCreateTime(LocalDateTime.now());
item.setUpdateTime(LocalDateTime.now());
save(item);
return ResultGenerator.genSuccessResult(item);
}
public Result delete(int id) {
removeById(id);
return ResultGenerator.genSuccessResult();
}
public Result getAll() {
return ResultGenerator.genSuccessResult(list());
}
public List<AdItem> getById(int id) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("ad_id",id);
return list(queryWrapper);
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.ad.service.impl;
import com.aopcloud.beam.app.api.ad.entity.AdPosition;
import com.aopcloud.beam.app.api.ad.mapper.AdPositionMapper;
import com.aopcloud.beam.app.api.ad.service.IAdPositionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 广告位表 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@Service
public class AdPositionServiceImpl extends ServiceImpl<AdPositionMapper, AdPosition> implements IAdPositionService {
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.ad.service.impl;
import com.aopcloud.beam.app.api.ad.entity.Ad;
import com.aopcloud.beam.app.api.ad.mapper.AdMapper;
import com.aopcloud.beam.app.api.ad.service.IAdService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* Banner表格 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
@Service
public class AdServiceImpl extends ServiceImpl<AdMapper, Ad> implements IAdService {
}

@ -0,0 +1,56 @@
package com.aopcloud.beam.app.api.ad.service.impl;
import com.aopcloud.beam.app.api.ad.entity.AdEntity;
import com.aopcloud.beam.app.api.ad.entity.AdItem;
import com.aopcloud.beam.app.api.ad.entity.Item;
import com.aopcloud.beam.app.api.ad.mapper.ItemMapper;
import com.aopcloud.beam.app.api.ad.service.IItemService;
import com.aopcloud.beam.app.core.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* Banner item 表格 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-21
*/
@Service
public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements IItemService {
public Result create(AdEntity adEntity) {
System.out.println(adEntity.img);
Item item = new Item();
item.setAdId(adEntity.adId);
item.setActionType(adEntity.eventType);
item.setActionEvent(adEntity.event);
item.setOssFileName(adEntity.getImg());
item.setCreateTime(LocalDateTime.now());
item.setUpdateTime(LocalDateTime.now());
save(item);
return ResultGenerator.genSuccessResult(item);
}
public Result delete(int id) {
removeById(id);
return ResultGenerator.genSuccessResult();
}
public Result getAll() {
return ResultGenerator.genSuccessResult(list());
}
public AdItemServiceImpl adItemService;
public List<AdItem> getAdList(int i) {
QueryWrapper queryWrapper= new QueryWrapper<AdItem>().eq("ad_id",i);
return adItemService.list(queryWrapper);
}
}

@ -0,0 +1,41 @@
package com.aopcloud.beam.app.api.app.controller;
import com.aopcloud.beam.app.api.app.service.impl.AppServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>
* Banner表格 前端控制器
* </p>
*
* @author Enoch
* @since 2021-01-29
*/
@RestController
@RequestMapping("/app/")
public class AppController {
@Resource
private AppServiceImpl service;
@GetMapping("/home")
public Result getList(){
return service.getHome();
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.app.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 首页货币 前端控制器
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@RestController
@RequestMapping("/app/home")
public class HomeCoinController {
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.app.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 首页广播 前端控制器
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@RestController
@RequestMapping("/app/home-notice")
public class HomeNoticeController {
}

@ -0,0 +1,52 @@
package com.aopcloud.beam.app.api.app.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* Banner表格
* </p>
*
* @author Enoch
* @since 2021-01-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class Banner implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* banner 名称广告位名称
*/
private String name;
/**
* banner 描述
*/
private String description;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

@ -0,0 +1,17 @@
package com.aopcloud.beam.app.api.app.entity;
import java.util.List;
import java.util.Map;
public class HomeBean {
public List banner;
public List notice;
public List coin;
public HomeBean() {
}
}

@ -0,0 +1,147 @@
package com.aopcloud.beam.app.api.app.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* <p>
* 首页货币
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@TableName("sly_home_coin")
public class HomeCoin implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 货币ID
*/
private Integer coinId;
/**
* icon
*/
private String imgOssFile;
/**
* 加载
*/
private BigDecimal price;
/**
* 奖励
*/
private String reward;
/**
* 平均出块时间
*/
private Integer averageTime;
/**
* 上一次出块时间
*/
private LocalDateTime lastTime;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCoinId() {
return coinId;
}
public void setCoinId(Integer coinId) {
this.coinId = coinId;
}
public String getImgOssFile() {
return imgOssFile;
}
public void setImgOssFile(String imgOssFile) {
this.imgOssFile = imgOssFile;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getReward() {
return reward;
}
public void setReward(String reward) {
this.reward = reward;
}
public Integer getAverageTime() {
return averageTime;
}
public void setAverageTime(Integer averageTime) {
this.averageTime = averageTime;
}
public LocalDateTime getLastTime() {
return lastTime;
}
public void setLastTime(LocalDateTime lastTime) {
this.lastTime = lastTime;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "HomeCoin{" +
"id=" + id +
", coinId=" + coinId +
", imgOssFile=" + imgOssFile +
", price=" + price +
", reward=" + reward +
", averageTime=" + averageTime +
", lastTime=" + lastTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,102 @@
package com.aopcloud.beam.app.api.app.entity;
public class HomeCoinBean {
private int id;
private int coinType;
private String coinEnName;//英文名称
private String coinCnName;//中午名称
private String coinIcon;//icon
private String average ;// 平均
private String lastTime;//上一次出块时间
private double amount;//金额
private double reward;//奖励
public HomeCoinBean(){
}
public HomeCoinBean(int id, int coinType, String coinEnName, String coinCnName, String coinIcon, String average, String lastTime, double amount, double reward) {
this.id = id;
this.coinType = coinType;
this.coinEnName = coinEnName;
this.coinCnName = coinCnName;
this.coinIcon = coinIcon;
this.average = average;
this.lastTime = lastTime;
this.amount = amount;
this.reward = reward;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCoinType() {
return coinType;
}
public void setCoinType(int coinType) {
this.coinType = coinType;
}
public String getCoinEnName() {
return coinEnName;
}
public void setCoinEnName(String coinEnName) {
this.coinEnName = coinEnName;
}
public String getCoinCnName() {
return coinCnName;
}
public void setCoinCnName(String coinCnName) {
this.coinCnName = coinCnName;
}
public String getCoinIcon() {
return coinIcon;
}
public void setCoinIcon(String coinIcon) {
this.coinIcon = coinIcon;
}
public String getAverage() {
return average;
}
public void setAverage(String average) {
this.average = average;
}
public String getLastTime() {
return lastTime;
}
public void setLastTime(String lastTime) {
this.lastTime = lastTime;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public double getReward() {
return reward;
}
public void setReward(double reward) {
this.reward = reward;
}
}

@ -0,0 +1,167 @@
package com.aopcloud.beam.app.api.app.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* <p>
* 首页广播
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@TableName("sly_home_notice")
public class HomeNotice implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 入库唯一编号
*/
private String noticeSn;
/**
* 货币ID
*/
private Integer coinId;
private String coinName;
/**
* 收益
*/
private BigDecimal profit;
/**
* 广播方发布方
*/
private String noticeSource;
private String remarks;
/**
* 广播时间通知时间
*/
private long noticeTimestamp;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCoinId() {
return coinId;
}
public void setCoinId(Integer coinId) {
this.coinId = coinId;
}
public BigDecimal getProfit() {
return profit;
}
public void setProfit(BigDecimal profit) {
this.profit = profit;
}
public String getNoticeSource() {
return noticeSource;
}
public void setNoticeSource(String noticeSource) {
this.noticeSource = noticeSource;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public long getNoticeTimestamp() {
return noticeTimestamp;
}
public void setNoticeTimestamp(long noticeTimestamp) {
this.noticeTimestamp = noticeTimestamp;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getCoinName() {
return coinName;
}
public void setCoinName(String coinName) {
this.coinName = coinName;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getNoticeSn() {
return noticeSn;
}
public void setNoticeSn(String noticeSn) {
this.noticeSn = noticeSn;
}
@Override
public String toString() {
return "HomeNotice{" +
"id=" + id +
", noticeSn='" + noticeSn + '\'' +
", coinId=" + coinId +
", coinName='" + coinName + '\'' +
", profit=" + profit +
", noticeSource='" + noticeSource + '\'' +
", remarks='" + remarks + '\'' +
", noticeTimestamp=" + noticeTimestamp +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

@ -0,0 +1,58 @@
package com.aopcloud.beam.app.api.app.entity;
public class NoticeBean {
private int id;
private String name;
private String url;
private long time = System.currentTimeMillis() / 1000;
private double coin;
private String coinName;
public double getCoin() {
return coin;
}
public void setCoin(double coin) {
this.coin = coin;
}
public String getCoinName() {
return coinName;
}
public void setCoinName(String coinName) {
this.coinName = coinName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.app.mapper;
import com.aopcloud.beam.app.api.app.entity.HomeCoin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 首页货币 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
public interface HomeCoinMapper extends BaseMapper<HomeCoin> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.app.mapper;
import com.aopcloud.beam.app.api.app.entity.HomeNotice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 首页广播 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
public interface HomeNoticeMapper extends BaseMapper<HomeNotice> {
}

@ -0,0 +1,4 @@
package com.aopcloud.beam.app.api.app.service;
public interface IAppService {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.app.service;
import com.aopcloud.beam.app.api.app.entity.HomeCoin;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 首页货币 服务类
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
public interface IHomeCoinService extends IService<HomeCoin> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.app.service;
import com.aopcloud.beam.app.api.app.entity.HomeNotice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 首页广播 服务类
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
public interface IHomeNoticeService extends IService<HomeNotice> {
}

@ -0,0 +1,45 @@
package com.aopcloud.beam.app.api.app.service.impl;
import com.aopcloud.beam.app.api.ad.entity.AdItem;
import com.aopcloud.beam.app.api.ad.service.impl.AdItemServiceImpl;
import com.aopcloud.beam.app.api.ad.service.impl.ItemServiceImpl;
import com.aopcloud.beam.app.api.app.entity.HomeCoinBean;
import com.aopcloud.beam.app.api.app.entity.HomeBean;
import com.aopcloud.beam.app.api.app.entity.HomeNotice;
import com.aopcloud.beam.app.api.app.entity.NoticeBean;
import com.aopcloud.beam.app.api.app.mapper.HomeNoticeMapper;
import com.aopcloud.beam.app.api.app.service.IAppService;
import com.aopcloud.beam.app.api.coin.service.impl.CoinServiceImpl;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class AppServiceImpl implements IAppService {
@Resource
private AdItemServiceImpl itemService;
@Resource
private HomeNoticeServiceImpl homeNoticeService;
@Resource
private CoinServiceImpl coinService;
public Result getHome() {
HomeBean homeBean = new HomeBean();
List<AdItem> list = itemService.getById(1);
homeBean.banner = list;
homeBean.notice = homeNoticeService.getList();
homeBean.coin = coinService.list();
return ResultGenerator.genSuccessResult(homeBean);
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.app.service.impl;
import com.aopcloud.beam.app.api.app.entity.HomeCoin;
import com.aopcloud.beam.app.api.app.mapper.HomeCoinMapper;
import com.aopcloud.beam.app.api.app.service.IHomeCoinService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 首页货币 服务实现类
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@Service
public class HomeCoinServiceImpl extends ServiceImpl<HomeCoinMapper, HomeCoin> implements IHomeCoinService {
}

@ -0,0 +1,34 @@
package com.aopcloud.beam.app.api.app.service.impl;
import com.aopcloud.beam.app.api.app.entity.HomeNotice;
import com.aopcloud.beam.app.api.app.mapper.HomeNoticeMapper;
import com.aopcloud.beam.app.api.app.service.IHomeNoticeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 首页广播 服务实现类
* </p>
*
* @author Enoch
* @since 2021-03-05
*/
@Service
public class HomeNoticeServiceImpl extends ServiceImpl<HomeNoticeMapper, HomeNotice> implements IHomeNoticeService {
public List getList() {
QueryWrapper<HomeNotice> notice = new QueryWrapper();
notice.orderByDesc("create_time");
notice.last("limit 0,10");
return baseMapper.selectList(notice);
}
}

@ -0,0 +1,86 @@
package com.aopcloud.beam.app.api.coin.controller;
import com.aopcloud.beam.app.api.coin.entity.CoinAction;
import com.aopcloud.beam.app.api.coin.service.impl.CoinServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* <p>
* 货币类型表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/coin")
public class CoinController {
@Resource
private CoinServiceImpl mCoinServiceImpl;
@PostMapping("/create")
public Result create(@RequestBody @Valid CoinAction action) {
// if (icon != null) {
// try {
// //当前项目下路径
// String realPath = System.getProperty("user.dir") + new String("/beam-system/src/main/resources/" + UPLOAD_PATH_PREFIX);
// System.out.println("-----------上传文件保存的路径【" + realPath + "】-----------");
// //存放上传文件的文件夹
// File folder = new File(realPath);
// System.out.println("-----------存放上传文件的文件夹【" + folder.getAbsolutePath() + "】-----------");
// System.out.println("-----------输出文件夹绝对路径 -- 这里的绝对路径是相当于当前项目的路径而不是“容器”路径【" + folder.getAbsolutePath() + "】-----------");
// if (!folder.isDirectory()) {
// //递归生成文件夹
// folder.mkdirs();
// }
// //获取原始的名字 方法是得到原来的文件名在客户机的文件系统名称
// String oldName = icon.getOriginalFilename();
// System.out.println("-----------文件原始的名字【" + oldName + "】-----------");
// //新命名=随机UUID+原始文件的后缀名
// String newName = "img_coin_" + System.currentTimeMillis() + oldName.substring(oldName.lastIndexOf("."));
// System.out.println("-----------文件要保存后的新名字【" + newName + "】-----------");
// File newFile = new File(folder.getAbsolutePath().replace("\\", "/") + File.separator + newName);
// System.out.println("-----------getAbsolutePath【" + newFile.getAbsolutePath() + "】-----------");
// //将图片保存到static文件夹里
// icon.transferTo(newFile);
// System.out.println("-----------getAbsolutePath【" + newFile.exists() + "/" + newFile.isFile() + "】-----------");
// String filePath = "/images/" + newName;
// System.out.println("icon:" + filePath);
// BeamImg img = new BeamImg();
//// img.setUrl(filePath);
//// img.setDescription("coin create icon");
//// img.setImgMd5("");
//// img.setCreateBy("coin create icon");
//// img.setCreateTime(LocalDateTime.now());
//// img.setUpdateTime(LocalDateTime.now());
// mImgService.save(img);
// return mCoinServiceImpl.create(img.getId(), name, description);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
return mCoinServiceImpl.create(action);
}
@PostMapping("/edit")
public Result editCoin(@RequestBody CoinAction action) {
return mCoinServiceImpl.edit(action);
}
@PostMapping("/delete")
public Result deleteCoin(@RequestBody CoinAction action) {
return mCoinServiceImpl.delete(action.getId());
}
@GetMapping("/list")
public Result list(@RequestParam(defaultValue = "1") int pageNo,
@RequestParam(defaultValue = "20") int pageSize) {
return mCoinServiceImpl.getList(pageNo, pageSize);
}
}

@ -0,0 +1,46 @@
package com.aopcloud.beam.app.api.coin.controller;
import com.aopcloud.beam.app.api.coin.entity.CoinPackage;
import com.aopcloud.beam.app.api.coin.service.impl.CoinPackageServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* <p>
* 算力包 前端控制器
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@RestController
@RequestMapping("/coin/package")
public class CoinPackageController {
@Resource
private CoinPackageServiceImpl mCoinServiceImpl;
@PostMapping("/create")
public Result create(@RequestBody @Valid CoinPackage entity) {
return mCoinServiceImpl.create(entity);
}
@PostMapping("/edit")
public Result edit(@RequestBody CoinPackage entity) {
return mCoinServiceImpl.edit(entity);
}
@PostMapping("/delete")
public Result delete(@RequestBody int id) {
return mCoinServiceImpl.delete(id);
}
@GetMapping("/list")
public Result list(@RequestParam(required = false ,defaultValue = "0") int coinId) {
return mCoinServiceImpl.getList(coinId);
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.coin.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 算力包单位 前端控制器
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@RestController
@RequestMapping("/coin/package/unit")
public class CoinPackageUnitController {
}

@ -0,0 +1,192 @@
package com.aopcloud.beam.app.api.coin.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 货币类型表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_coin")
public class Coin implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 英文名称
*/
private String enName;
/**
* 中文名称
*/
private String cnName;
/**
* img name
*/
@JsonIgnore
private String imgOssFile;
/**
* 奖励
*/
private BigDecimal reward;
/**
* 平均出块时间
*/
private Integer averageDuration;
/**
*最新币价
*/
private BigDecimal currentPrice;
/**
*最新出块时间戳
*/
private Long latestTime;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
@TableField(exist = false)
public String icon ;
public String getIcon() {
return AliyunOSSUtil.getInstance().getFileUrl(imgOssFile);
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getImgOssFile() {
return imgOssFile;
}
public void setImgOssFile(String imgOssFile) {
this.imgOssFile = imgOssFile;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public BigDecimal getCurrentPrice() {
return currentPrice;
}
public void setCurrentPrice(BigDecimal currentPrice) {
this.currentPrice = currentPrice;
}
public Long getLatestTime() {
return latestTime;
}
public void setLatestTime(Long latestTime) {
this.latestTime = latestTime;
}
public BigDecimal getReward() {
return reward;
}
public void setReward(BigDecimal reward) {
this.reward = reward;
}
public Integer getAverageDuration() {
return averageDuration;
}
public void setAverageDuration(Integer averageDuration) {
this.averageDuration = averageDuration;
}
@Override
public String toString() {
return "Coin{" +
"id=" + id +
", enName='" + enName + '\'' +
", cnName='" + cnName + '\'' +
", imgOssFile='" + imgOssFile + '\'' +
", reward='" + reward + '\'' +
", averageDuration=" + averageDuration +
", currentPrice=" + currentPrice +
", latestTime=" + latestTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
", icon='" + icon + '\'' +
'}';
}
}

@ -0,0 +1,56 @@
package com.aopcloud.beam.app.api.coin.entity;
import javax.validation.constraints.NotBlank;
public class CoinAction {
private int id;
@NotBlank(message = "货币名称不能为空")
private String cnName;
@NotBlank(message = "货币简写不能为空")
private String enName;
@NotBlank(message = "货币Icon不能为空")
private String imgOssFile;
private String description;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImgOssFile() {
return imgOssFile;
}
public void setImgOssFile(String imgOssFile) {
this.imgOssFile = imgOssFile;
}
}

@ -0,0 +1,175 @@
package com.aopcloud.beam.app.api.coin.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* <p>
* 算力包
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@TableName("sly_coin_package")
public class CoinPackage implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
// /**
// * 货币ID
// */
// @NotNull(message="货币ID不能为空!")
// private Long coinId;
//
/**
* 单位时间
*/
@NotNull(message="算力包单位时间必须大于等于1分钟!")
private Integer duration;
/**
* 包名称
*/
@NotBlank(message = "算力包名称不能为空")
private String title;
/**
* 单价
*/
@DecimalMin(value = "1", message = "算力包单价必须大0")
@NotNull(message = "算力包单价必须大0")
private BigDecimal price;
/**
* 算力包 单位数量
*/
@NotNull(message = "算力包单位数量不能为空")
private Integer number;
/**
* 算力包单位ID
*/
@NotNull(message = "算力包名单位ID不能为空")
private Long packageUnitId;
/**
* 算力包单位名称
*/
@NotBlank(message = "算力包单位名称不能为空")
private String packageUnitName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Long getPackageUnitId() {
return packageUnitId;
}
public void setPackageUnitId(Long packageUnitId) {
this.packageUnitId = packageUnitId;
}
public String getPackageUnitName() {
return packageUnitName;
}
public void setPackageUnitName(String packageUnitName) {
this.packageUnitName = packageUnitName;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
@Override
public String toString() {
return "CoinPackage{" +
"id=" + id +
", duration=" + duration +
", title='" + title + '\'' +
", price=" + price +
", number=" + number +
", packageUnitId=" + packageUnitId +
", packageUnitName='" + packageUnitName + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

@ -0,0 +1,94 @@
package com.aopcloud.beam.app.api.coin.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* <p>
* 算力包单位
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@TableName("sly_coin_package_unit")
public class CoinPackageUnit implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 单位名称
*/
private String name;
/**
* 备注
*/
private String desc;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "CoinPackageUnit{" +
"id=" + id +
", name=" + name +
", desc=" + desc +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.mapper;
import com.aopcloud.beam.app.api.coin.entity.Coin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 货币类型表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface CoinMapper extends BaseMapper<Coin> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.mapper;
import com.aopcloud.beam.app.api.coin.entity.CoinPackage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 算力包 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
public interface CoinPackageMapper extends BaseMapper<CoinPackage> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.mapper;
import com.aopcloud.beam.app.api.coin.entity.CoinPackageUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 算力包单位 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
public interface CoinPackageUnitMapper extends BaseMapper<CoinPackageUnit> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.service;
import com.aopcloud.beam.app.api.coin.entity.CoinPackage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 算力包 服务类
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
public interface ICoinPackageService extends IService<CoinPackage> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.service;
import com.aopcloud.beam.app.api.coin.entity.CoinPackageUnit;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 算力包单位 服务类
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
public interface ICoinPackageUnitService extends IService<CoinPackageUnit> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.coin.service;
import com.aopcloud.beam.app.api.coin.entity.Coin;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 货币类型表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface ICoinService extends IService<Coin> {
}

@ -0,0 +1,46 @@
package com.aopcloud.beam.app.api.coin.service.impl;
import com.alibaba.fastjson.JSON;
import com.aopcloud.beam.app.api.coin.entity.CoinPackage;
import com.aopcloud.beam.app.api.coin.mapper.CoinPackageMapper;
import com.aopcloud.beam.app.api.coin.service.ICoinPackageService;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 算力包 服务实现类
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@Service
public class CoinPackageServiceImpl extends ServiceImpl<CoinPackageMapper, CoinPackage> implements ICoinPackageService {
public Result create(CoinPackage entity) {
System.out.println("create:"+JSON.toJSONString(entity));
save(entity);
return ResultGenerator.genSuccessResult(entity.getId());
}
public Result edit(CoinPackage entity) {
System.out.println("edit:"+JSON.toJSONString(entity));
updateById(entity);
return ResultGenerator.genSuccessResult(entity);
}
public Result delete(int id) {
removeById(id);
return ResultGenerator.genSuccessResult();
}
public Result getList(int coinId) {
return ResultGenerator.genSuccessResult(list());
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.coin.service.impl;
import com.aopcloud.beam.app.api.coin.entity.CoinPackageUnit;
import com.aopcloud.beam.app.api.coin.mapper.CoinPackageUnitMapper;
import com.aopcloud.beam.app.api.coin.service.ICoinPackageUnitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 算力包单位 服务实现类
* </p>
*
* @author Enoch
* @since 2021-03-01
*/
@Service
public class CoinPackageUnitServiceImpl extends ServiceImpl<CoinPackageUnitMapper, CoinPackageUnit> implements ICoinPackageUnitService {
}

@ -0,0 +1,70 @@
package com.aopcloud.beam.app.api.coin.service.impl;
import com.aopcloud.beam.app.api.coin.entity.Coin;
import com.aopcloud.beam.app.api.coin.entity.CoinAction;
import com.aopcloud.beam.app.api.coin.mapper.CoinMapper;
import com.aopcloud.beam.app.api.coin.service.ICoinService;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 货币类型表 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@Service
public class CoinServiceImpl extends ServiceImpl<CoinMapper, Coin> implements ICoinService {
public Result add(CoinAction coinAction) {
Coin coin = new Coin();
BeanUtils.copyProperties(coinAction, coin);
baseMapper.insert(coin);
return ResultGenerator.genSuccessResult();
}
public Result edit(CoinAction coinAction) {
Coin mCoin = baseMapper.selectOne(new QueryWrapper<Coin>().ge("id", coinAction.getId()));
if (mCoin == null) {
return ResultGenerator.genFailResult("货币类型不存在");
}
BeanUtils.copyProperties(coinAction, mCoin);
baseMapper.update(mCoin, new UpdateWrapper<>());
return ResultGenerator.genSuccessResult();
}
public Result delete(int deleteId) {
baseMapper.deleteById(deleteId);
return ResultGenerator.genSuccessResult("删除成功");
}
public Result getList(Integer pageIndex, Integer size) {
Page<Coin> page = new Page<>(pageIndex, size);
Page<Coin> userMyPage = page(page);
return ResultGenerator.genSuccessResult(userMyPage.getRecords());
}
public Result create(CoinAction action) {
Coin coin = new Coin();
coin.setImgOssFile("" + action.getImgOssFile());
coin.setCnName(action.getCnName());
coin.setEnName(action.getEnName());
coin.setCreateTime(LocalDateTime.now());
coin.setUpdateTime(LocalDateTime.now());
baseMapper.insert(coin);
return ResultGenerator.genSuccessResult();
}
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.img.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* img 表格 前端控制器
* </p>
*
* @author Enoch
* @since 2021-01-30
*/
@RestController
@RequestMapping("/img/beam-img")
public class BeamImgController {
}

@ -0,0 +1,61 @@
package com.aopcloud.beam.app.api.img.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* img 表格
* </p>
*
* @author Enoch
* @since 2021-01-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class BeamImg implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* url
*/
private String url;
/**
* url 描述
*/
private String description;
/**
* file_md5
*/
private String imgMd5;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.img.mapper;
import com.aopcloud.beam.app.api.img.entity.BeamImg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* img 表格 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-01-30
*/
public interface BeamImgMapper extends BaseMapper<BeamImg> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.img.service;
import com.aopcloud.beam.app.api.img.entity.BeamImg;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* img 表格 服务类
* </p>
*
* @author Enoch
* @since 2021-01-30
*/
public interface IBeamImgService extends IService<BeamImg> {
}

@ -0,0 +1,20 @@
package com.aopcloud.beam.app.api.img.service.impl;
import com.aopcloud.beam.app.api.img.entity.BeamImg;
import com.aopcloud.beam.app.api.img.mapper.BeamImgMapper;
import com.aopcloud.beam.app.api.img.service.IBeamImgService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* img 表格 服务实现类
* </p>
*
* @author Enoch
* @since 2021-01-30
*/
@Service
public class BeamImgServiceImpl extends ServiceImpl<BeamImgMapper, BeamImg> implements IBeamImgService {
}

@ -0,0 +1,50 @@
package com.aopcloud.beam.app.api.member.controller;
import com.aopcloud.beam.app.api.member.entity.AddCoinAddress;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.aopcloud.beam.app.api.member.service.impl.MemberCoinAddressServiceImpl;
import com.aopcloud.beam.app.core.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
/**
* <p>
* 会员货币地址表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member/address")
public class MemberCoinAddressController {
@Resource
private MemberCoinAddressServiceImpl service;
@PostMapping("/create")
public Result create(@RequestBody HashMap<String,Object> params){
return service.create(params);
}
@PostMapping("/delete")
public Result delete(@RequestBody HashMap<String, Object> params) {
return service.delete((Integer) params.get("id"));
}
@GetMapping("/list")
public Result getList(@RequestHeader(required = false) String token,@RequestParam(required = false,defaultValue = "0") int coinId) {
return service.getList(token,coinId);
}
}

@ -0,0 +1,38 @@
package com.aopcloud.beam.app.api.member.controller;
import com.aopcloud.beam.app.api.member.service.impl.MemberCoinAddressServiceImpl;
import com.aopcloud.beam.app.api.member.service.impl.MemberCoinRecordServiceImpl;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>
* 会员挖矿记录表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member/profit")
public class MemberCoinRecordController {
@Resource
private MemberCoinRecordServiceImpl recordService;
@GetMapping("/list")
public Result getList(@RequestHeader String token) {
return recordService.getList(token);
}
}

@ -0,0 +1,80 @@
package com.aopcloud.beam.app.api.member.controller;
import com.alibaba.fastjson.JSON;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.aopcloud.beam.app.api.member.entity.MemberActionBean;
import com.aopcloud.beam.app.api.member.service.impl.MemberServiceImpl;
import com.aopcloud.beam.app.api.user.entity.UpdateUserEntity;
import com.aopcloud.beam.app.api.user.entity.UserActionBean;
import com.aopcloud.beam.app.annotion.LoginRequired;
import com.aopcloud.beam.app.core.Result;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.Map;
/**
* <p>
* 会员表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member")
public class MemberController {
@Resource
MemberServiceImpl beamUserService;
@PostMapping("/register")
public Result register(@RequestBody @Valid MemberActionBean register) {
return beamUserService.register(register);
}
@PostMapping("/login")
public Result login(@RequestBody MemberActionBean register) {
return beamUserService.login(register);
}
@PostMapping("/logout")
public Result logout(@RequestHeader @NotBlank String token) {
return beamUserService.logout(token);
}
@LoginRequired
@PostMapping("/edit")
public Result edit(@RequestHeader @NotBlank String token, @RequestBody @Valid UpdateUserEntity user) {
return beamUserService.edit(token, user);
}
@LoginRequired
@GetMapping("/info")
public Result getInfo(@RequestHeader @NotBlank String token) {
return beamUserService.getInfo(token);
}
@PostMapping("/forgePassword")
public Result getPassword(@RequestBody @Valid MemberActionBean actionBean) {
return beamUserService.getPassword(actionBean);
}
@LoginRequired
@PostMapping("/updatePassword")
public Result updatePassword(@RequestBody Map<String, String> actionBean, @RequestHeader String token) {
System.out.println(JSON.toJSONString(actionBean));
return beamUserService.updatePassword(token, actionBean);
}
@GetMapping("/history")
public Result history(@RequestHeader @NotBlank String token) {
return beamUserService.history(token);
}
}

@ -0,0 +1,19 @@
package com.aopcloud.beam.app.api.member.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 会员等级表 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member/level")
public class MemberLevelController {
}

@ -0,0 +1,19 @@
package com.aopcloud.beam.app.api.member.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 会员登录记录 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member/login/log")
public class MemberLoginLogController {
}

@ -0,0 +1,19 @@
package com.aopcloud.beam.app.api.member.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 会员统计信息 前端控制器
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@RestController
@RequestMapping("/member/statistics/info")
public class MemberStatisticsInfoController {
}

@ -0,0 +1,14 @@
package com.aopcloud.beam.app.api.member.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
public class AddCoinAddress {
@NotBlank(message = "手机号不能为空")
private String phone;
@Size(max = 20, min = 6 ,message = "密码长度最低为6位")
private String password;
private String code="";
private String name;
}

@ -0,0 +1,278 @@
package com.aopcloud.beam.app.api.member.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* <p>
* 会员表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member")
public class Member implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String memberSn;
private Long memberLevelId;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String nickname;
/**
* 头像
*/
@JsonIgnore
private String avatarOssFile;
/**
* 手机号码
*/
private String phone;
/**
* 帐号启用状态:0->禁用1->启用; 2->删除
*/
private Integer status;
/**
* 性别0->未知1->2->
*/
private Integer gender;
/**
* 生日
*/
private LocalDate birthday;
/**
* 所做城市
*/
private String city;
/**
* 个性签名
*/
private String personalizedSignature;
/**
* 用户来源
*/
private Integer sourceType;
/**
* 注册时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* Token
*/
private String token;
@TableField(exist = false)
private String avatar;
public String getAvatar() {
return AliyunOSSUtil.getInstance().getFileUrl(avatarOssFile);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getMemberSn() {
return memberSn;
}
public void setMemberSn(String memberSn) {
this.memberSn = memberSn;
}
public Long getMemberLevelId() {
return memberLevelId;
}
public void setMemberLevelId(Long memberLevelId) {
this.memberLevelId = memberLevelId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getAvatarOssFile() {
return avatarOssFile;
}
public void setAvatarOssFile(String avatarOssFile) {
this.avatarOssFile = avatarOssFile;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getGender() {
return gender;
}
public void setGender(Integer gender) {
this.gender = gender;
}
public LocalDate getBirthday() {
return birthday;
}
public void setBirthday(LocalDate birthday) {
this.birthday = birthday;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getPersonalizedSignature() {
return personalizedSignature;
}
public void setPersonalizedSignature(String personalizedSignature) {
this.personalizedSignature = personalizedSignature;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
@Override
public String toString() {
return "Member{" +
"id=" + id +
", memberSn='" + memberSn + '\'' +
", memberLevelId=" + memberLevelId +
", username='" + username + '\'' +
", password='" + password + '\'' +
", nickname='" + nickname + '\'' +
", avatarOssFile='" + avatarOssFile + '\'' +
", phone='" + phone + '\'' +
", status=" + status +
", gender=" + gender +
", birthday=" + birthday +
", city='" + city + '\'' +
", personalizedSignature='" + personalizedSignature + '\'' +
", sourceType=" + sourceType +
", createTime=" + createTime +
", updateTime=" + updateTime +
", token='" + token + '\'' +
", avatar='" + avatar + '\'' +
'}';
}
}

@ -0,0 +1,65 @@
package com.aopcloud.beam.app.api.member.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
public class MemberActionBean {
@NotBlank(message = "手机号不能为空")
private String phone;
private String lodPassword;
@NotBlank(message = "密码不能为空")
private String password;
private String code="";
private String name;
private String ossFile;
public String getLodPassword() {
return lodPassword;
}
public void setLodPassword(String lodPassword) {
this.lodPassword = lodPassword;
}
public String getOssFile() {
return ossFile;
}
public void setOssFile(String ossFile) {
this.ossFile = ossFile;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,165 @@
package com.aopcloud.beam.app.api.member.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 会员货币地址表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member_coin_address")
public class MemberCoinAddress implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 货币ID
*/
private Integer coinId;
/**
* 用户ID
*/
private Integer memberId;
/**
* 钱包地址
*/
private String address;
/**
* coin 描述
*/
private String description;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 英文名称
*/
@TableField(exist = false)
private String enName;
/**
* 中文名称
*/
@TableField(exist = false)
private String cnName;
/**
* img name
*/
@JsonIgnore
@TableField(exist = false)
private String imgOssFile;
@TableField(exist = false)
public String icon ;
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getIcon() {
return AliyunOSSUtil.getInstance().getFileUrl(imgOssFile);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCoinId() {
return coinId;
}
public void setCoinId(Integer coinId) {
this.coinId = coinId;
}
public Integer getMemberId() {
return memberId;
}
public void setMemberId(Integer memberId) {
this.memberId = memberId;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "MemberCoinAddress{" +
"id=" + id +
", coinId=" + coinId +
", memberId=" + memberId +
", address=" + address +
", description=" + description +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,217 @@
package com.aopcloud.beam.app.api.member.entity;
import com.aopcloud.beam.app.util.AliyunOSSUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 会员挖矿记录表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member_coin_record")
public class MemberCoinRecord implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 货币ID
*/
private Integer coinId;
/**
* 用户ID
*/
private Long memberId;
/**
* 钱包地址
*/
private String address;
/**
* 收益
*/
private BigDecimal profit;
/**
* 记录编号
*/
private String recordSn;
/**
* 订单编号
*/
private String orderSn;
/**
* 备注
*/
private String remarks;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 英文名称
*/
@TableField(exist = false)
private String enName;
/**
* 中文名称
*/
@TableField(exist = false)
private String cnName;
/**
* img name
*/
@JsonIgnore
@TableField(exist = false)
private String imgOssFile;
@TableField(exist = false)
public String icon ;
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getImgOssFile() {
return imgOssFile;
}
public void setImgOssFile(String imgOssFile) {
this.imgOssFile = imgOssFile;
}
public String getIcon() {
return AliyunOSSUtil.getInstance().getFileUrl(imgOssFile);
}
public void setIcon(String icon) {
this.icon = icon;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCoinId() {
return coinId;
}
public void setCoinId(Integer coinId) {
this.coinId = coinId;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public BigDecimal getProfit() {
return profit;
}
public void setProfit(BigDecimal profit) {
this.profit = profit;
}
public String getRecordSn() {
return recordSn;
}
public void setRecordSn(String recordSn) {
this.recordSn = recordSn;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "MemberCoinRecord{" +
"id=" + id +
", coinId=" + coinId +
", memberId=" + memberId +
", address=" + address +
", profit=" + profit +
", recordSn=" + recordSn +
", orderSn=" + orderSn +
", remarks=" + remarks +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,161 @@
package com.aopcloud.beam.app.api.member.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 会员等级表
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member_level")
public class MemberLevel implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String name;
private Integer growthPoint;
/**
* 是否为默认等级0->不是1->
*/
private Integer defaultStatus;
/**
* 是否有签到特权
*/
private Integer priviledgeSignIn;
/**
* 是否有专享活动特权
*/
private Integer priviledgePromotion;
/**
* 是否有会员价格特权
*/
private Integer priviledgeMemberPrice;
/**
* 是否有生日特权
*/
private Integer priviledgeBirthday;
private String note;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getGrowthPoint() {
return growthPoint;
}
public void setGrowthPoint(Integer growthPoint) {
this.growthPoint = growthPoint;
}
public Integer getDefaultStatus() {
return defaultStatus;
}
public void setDefaultStatus(Integer defaultStatus) {
this.defaultStatus = defaultStatus;
}
public Integer getPriviledgeSignIn() {
return priviledgeSignIn;
}
public void setPriviledgeSignIn(Integer priviledgeSignIn) {
this.priviledgeSignIn = priviledgeSignIn;
}
public Integer getPriviledgePromotion() {
return priviledgePromotion;
}
public void setPriviledgePromotion(Integer priviledgePromotion) {
this.priviledgePromotion = priviledgePromotion;
}
public Integer getPriviledgeMemberPrice() {
return priviledgeMemberPrice;
}
public void setPriviledgeMemberPrice(Integer priviledgeMemberPrice) {
this.priviledgeMemberPrice = priviledgeMemberPrice;
}
public Integer getPriviledgeBirthday() {
return priviledgeBirthday;
}
public void setPriviledgeBirthday(Integer priviledgeBirthday) {
this.priviledgeBirthday = priviledgeBirthday;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "MemberLevel{" +
"id=" + id +
", name=" + name +
", growthPoint=" + growthPoint +
", defaultStatus=" + defaultStatus +
", priviledgeSignIn=" + priviledgeSignIn +
", priviledgePromotion=" + priviledgePromotion +
", priviledgeMemberPrice=" + priviledgeMemberPrice +
", priviledgeBirthday=" + priviledgeBirthday +
", note=" + note +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,119 @@
package com.aopcloud.beam.app.api.member.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 会员登录记录
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member_login_log")
public class MemberLoginLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long memberId;
private String ip;
private String city;
/**
* 登录类型0->PC1->android;2->ios;3->小程序
*/
private Integer loginType;
private String province;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Integer getLoginType() {
return loginType;
}
public void setLoginType(Integer loginType) {
this.loginType = loginType;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "MemberLoginLog{" +
"id=" + id +
", memberId=" + memberId +
", ip=" + ip +
", city=" + city +
", loginType=" + loginType +
", province=" + province +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,142 @@
package com.aopcloud.beam.app.api.member.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 会员统计信息
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@TableName("sly_member_statistics_info")
public class MemberStatisticsInfo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long memberId;
/**
* 累计消费金额
*/
private BigDecimal consumeAmount;
/**
* 订单数量
*/
private Integer orderCount;
/**
* 登录次数
*/
private Integer loginCount;
/**
* 钱包地址数量
*/
private Integer coinAddressCount;
/**
* 最后一次下订单时间
*/
private LocalDateTime recentOrderTime;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public BigDecimal getConsumeAmount() {
return consumeAmount;
}
public void setConsumeAmount(BigDecimal consumeAmount) {
this.consumeAmount = consumeAmount;
}
public Integer getOrderCount() {
return orderCount;
}
public void setOrderCount(Integer orderCount) {
this.orderCount = orderCount;
}
public Integer getLoginCount() {
return loginCount;
}
public void setLoginCount(Integer loginCount) {
this.loginCount = loginCount;
}
public Integer getCoinAddressCount() {
return coinAddressCount;
}
public void setCoinAddressCount(Integer coinAddressCount) {
this.coinAddressCount = coinAddressCount;
}
public LocalDateTime getRecentOrderTime() {
return recentOrderTime;
}
public void setRecentOrderTime(LocalDateTime recentOrderTime) {
this.recentOrderTime = recentOrderTime;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "MemberStatisticsInfo{" +
"id=" + id +
", memberId=" + memberId +
", consumeAmount=" + consumeAmount +
", orderCount=" + orderCount +
", loginCount=" + loginCount +
", coinAddressCount=" + coinAddressCount +
", recentOrderTime=" + recentOrderTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
"}";
}
}

@ -0,0 +1,34 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.MemberCoinAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* 会员货币地址表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberCoinAddressMapper extends BaseMapper<MemberCoinAddress> {
/**
* @return
*/
@Select("SELECT distinct sly_member_coin_address.*,sly_coin.`cn_name` AS cnName ,sly_coin.`en_name` AS enName ,sly_coin.`img_oss_file` AS imgOssFile FROM sly_member_coin_address,sly_member, sly_coin WHERE sly_member_coin_address.coin_id=sly_coin.id AND sly_member_coin_address.member_id= #{memberId} ")
List<MemberCoinAddress> getAddressList(@Param("memberId")long memberId);
/**
* @return
*/
@Select("SELECT distinct sly_member_coin_address.*,sly_coin.`cn_name` AS cnName ,sly_coin.`en_name` AS enName ,sly_coin.`img_oss_file` AS imgOssFile FROM sly_member_coin_address,sly_member, sly_coin WHERE sly_member_coin_address.coin_id= #{coinId} AND sly_coin.id= #{coinId} AND sly_member_coin_address.member_id= #{memberId} ")
List<MemberCoinAddress> getAddressListByCoinId(@Param("memberId")long memberId, @Param("coinId")long coinId);
}

@ -0,0 +1,26 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.MemberCoinAddress;
import com.aopcloud.beam.app.api.member.entity.MemberCoinRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* 会员挖矿记录表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberCoinRecordMapper extends BaseMapper<MemberCoinRecord> {
/**
* @return
*/
@Select("SELECT distinct sly_member_coin_record.*,sly_coin.`cn_name` AS cnName ,sly_coin.`en_name` AS enName ,sly_coin.`img_oss_file` AS imgOssFile FROM sly_member_coin_record,sly_member, sly_coin WHERE sly_member_coin_record.coin_id=sly_coin.id AND sly_member_coin_record.member_id= ${memberId} ")
List<MemberCoinRecord> getList(long memberId);
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.MemberLevel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 会员等级表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberLevelMapper extends BaseMapper<MemberLevel> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.MemberLoginLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 会员登录记录 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberLoginLogMapper extends BaseMapper<MemberLoginLog> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 会员表 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberMapper extends BaseMapper<Member> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.mapper;
import com.aopcloud.beam.app.api.member.entity.MemberStatisticsInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 会员统计信息 Mapper 接口
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface MemberStatisticsInfoMapper extends BaseMapper<MemberStatisticsInfo> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.MemberCoinAddress;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员货币地址表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberCoinAddressService extends IService<MemberCoinAddress> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.MemberCoinRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员挖矿记录表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberCoinRecordService extends IService<MemberCoinRecord> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.MemberLevel;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员等级表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberLevelService extends IService<MemberLevel> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.MemberLoginLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员登录记录 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberLoginLogService extends IService<MemberLoginLog> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员表 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberService extends IService<Member> {
}

@ -0,0 +1,16 @@
package com.aopcloud.beam.app.api.member.service;
import com.aopcloud.beam.app.api.member.entity.MemberStatisticsInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 会员统计信息 服务类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
public interface IMemberStatisticsInfoService extends IService<MemberStatisticsInfo> {
}

@ -0,0 +1,70 @@
package com.aopcloud.beam.app.api.member.service.impl;
import com.aopcloud.beam.app.api.member.entity.AddCoinAddress;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.aopcloud.beam.app.api.member.entity.MemberCoinAddress;
import com.aopcloud.beam.app.api.member.mapper.MemberCoinAddressMapper;
import com.aopcloud.beam.app.api.member.service.IMemberCoinAddressService;
import com.aopcloud.beam.app.core.AppException;;
import com.aopcloud.beam.app.core.ResultGenerator;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import javax.annotation.Resource;
import java.util.Map;
/**
* <p>
* 会员货币地址表 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@Service
public class MemberCoinAddressServiceImpl extends ServiceImpl<MemberCoinAddressMapper, MemberCoinAddress> implements IMemberCoinAddressService {
@Resource
private MemberServiceImpl memberService;
public Result getList(String token,int coinId) {
Member member = memberService.getMemberByToken(token);
if (coinId>0){
return ResultGenerator.genSuccessResult(baseMapper.getAddressListByCoinId(member.getId(),coinId));
}else {
return ResultGenerator.genSuccessResult(baseMapper.getAddressList(member.getId()));
}
}
public Result delete(Integer id) {
removeById(id);
return ResultGenerator.genSuccessResult();
}
public Result create(Map<String, Object> params) {
String token = (String) params.get("token");
Integer coinId = (Integer) params.get("coinId");
Integer memberId = (Integer) params.get("memberId");
if (StringUtils.isEmpty(token)) {
throw new AppException("地址不能为空");
}
if (coinId < 1) {
throw new AppException("货币类型不能为空");
}
if (memberId < 1) {
throw new AppException("地址不能为空");
}
MemberCoinAddress address = new MemberCoinAddress();
address.setAddress(token);
address.setCoinId(coinId);
address.setMemberId(memberId);
address.setDescription("");
save(address);
return ResultGenerator.genSuccessResult();
}
}

@ -0,0 +1,35 @@
package com.aopcloud.beam.app.api.member.service.impl;
import com.aopcloud.beam.app.api.member.entity.Member;
import com.aopcloud.beam.app.api.member.entity.MemberCoinRecord;
import com.aopcloud.beam.app.api.member.mapper.MemberCoinRecordMapper;
import com.aopcloud.beam.app.api.member.service.IMemberCoinRecordService;
import com.aopcloud.beam.app.core.Result;
import com.aopcloud.beam.app.core.ResultGenerator;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 会员挖矿记录表 服务实现类
* </p>
*
* @author Enoch
* @since 2021-02-24
*/
@Service
public class MemberCoinRecordServiceImpl extends ServiceImpl<MemberCoinRecordMapper, MemberCoinRecord> implements IMemberCoinRecordService {
@Resource
private MemberServiceImpl memberService;
public Result getList(String token) {
Member member = memberService.getMemberByToken(token);
return ResultGenerator.genSuccessResult(baseMapper.getList(member.getId()));
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save