commit 1f0bec8fb2c62fc59d27b21cbc090140d99c02bc Author: 1186 <13640910284@163.com> Date: Mon May 27 15:45:28 2024 +0800 初始版本提交 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..46e0f5a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +pipeline { + agent { + label 'test20' + } + + stages { + stage('build') { + steps { + sh ''' + source /etc/profile + mvn clean package -Dmaven.test.skip=true -U + ''' + } + } + + stage('deploy') { + steps { + sh ''' + source /etc/profile + cp -f fifa-api/target/fifa-api-1.1-SNAPSHOT.jar /data/upload/fifa-maker-api/ + sh /data/upload/fifa-maker-api/build.sh + ''' + } + } + } +} diff --git a/alive-api/pom.xml b/alive-api/pom.xml new file mode 100644 index 0000000..2886526 --- /dev/null +++ b/alive-api/pom.xml @@ -0,0 +1,180 @@ + + + + com.alive + alive-api-server + 1.0-SNAPSHOT + + 4.0.0 + alive-api + jar + + + 1.8 + + + + + com.alive + alive-db + 1.0-SNAPSHOT + + + + com.aliyun.oss + aliyun-sdk-oss + 3.13.2 + + + + org.bouncycastle + bcprov-jdk15on + 1.69 + + + + org.bitcoinj + bitcoinj-core + 0.15.9 + + + + com.alive + alive-commons + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-test + test + + + + mysql + mysql-connector-java + runtime + + + + org.projectlombok + lombok + true + + + + org.web3j + core + 5.0.0 + + + + com.squareup.okhttp3 + okhttp + 4.3.1 + + + + oauth.signpost + signpost-core + 1.2.1.2 + + + + oauth.signpost + signpost-commonshttp4 + 1.2.1.2 + + + + com.twitter + twitter-api-java-sdk + 1.1.4 + + + + commons-httpclient + commons-httpclient + 3.1 + + + + com.google.guava + guava + 29.0-jre + + + org.bitcoinj + bitcoinj-core + 0.15.5 + + + + + org.telegram + telegrambots + 6.0.1 + + + + + org.codehaus.groovy + groovy + + + com.google.code.gson + gson + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.mybatis + mybatis + 3.5.9 + compile + + + org.apache.xmlbeans + xmlbeans + 3.1.0 + compile + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.13.1 + + + + addSources + addTestSources + generateStubs + compile + generateTestStubs + compileTests + removeStubs + removeTestStubs + + + + + + + \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/AliveApiApplication.java b/alive-api/src/main/java/com/alive/server/AliveApiApplication.java new file mode 100644 index 0000000..af86ea1 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/AliveApiApplication.java @@ -0,0 +1,17 @@ +package com.alive.server; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@Slf4j +@SpringBootApplication(scanBasePackages = "com.alive") +@EnableScheduling +public class AliveApiApplication { + + public static void main(String[] args) { + SpringApplication.run(AliveApiApplication.class, args); + log.info("--------------ALIVE项目启动完成11-------------------"); + } +} diff --git a/alive-api/src/main/java/com/alive/server/BotRunnerInit.java b/alive-api/src/main/java/com/alive/server/BotRunnerInit.java new file mode 100644 index 0000000..c1ccfee --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/BotRunnerInit.java @@ -0,0 +1,40 @@ +package com.alive.server; + +import com.alive.server.service.TelegramServer; +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.CommandLineRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.telegram.telegrambots.meta.TelegramBotsApi; +import org.telegram.telegrambots.meta.exceptions.TelegramApiException; +import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; + + +@Order(2) //通过order注解指定执行顺序 +@Component +@Slf4j +public class BotRunnerInit implements CommandLineRunner { + + @Autowired + private DSLContext dslContext; + + @Value("${com.alive.task.bot}") + private Boolean taskBot; + + @Override + public void run(String... args){ + /*if(!taskBot){ + return; + } + TelegramBotsApi botsApi = null; + try { + botsApi = new TelegramBotsApi(DefaultBotSession.class); + botsApi.registerBot(new TelegramServer(dslContext)); + } catch (TelegramApiException e) { + log.error("TG连接网络异常-------err:{}",e.getMessage()); + }*/ + } +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/CorsConfig.java b/alive-api/src/main/java/com/alive/server/CorsConfig.java new file mode 100644 index 0000000..982298c --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/CorsConfig.java @@ -0,0 +1,32 @@ +package com.alive.server; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +/** + * 实现基本的跨域请求 + * @author linhongcun + * + */ +@Configuration +public class CorsConfig { + + @Bean + public CorsFilter corsFilter() { + final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); + final CorsConfiguration corsConfiguration = new CorsConfiguration(); + /*是否允许请求带有验证信息*/ + corsConfiguration.setAllowCredentials(true); + /*允许访问的客户端域名*/ + corsConfiguration.addAllowedOrigin("*"); + /*允许服务端访问的客户端请求头*/ + corsConfiguration.addAllowedHeader("*"); + /*允许访问的方法名,GET POST等*/ + corsConfiguration.addAllowedMethod("*"); + urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); + return new CorsFilter(urlBasedCorsConfigurationSource); + } +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/api/AccountController.java b/alive-api/src/main/java/com/alive/server/api/AccountController.java new file mode 100644 index 0000000..dc5fa3e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/AccountController.java @@ -0,0 +1,252 @@ +package com.alive.server.api; + +import com.alive.commons.util.*; +import com.alive.server.api.account.AccountSignInReq; +import com.alive.server.api.account.AccountSignInResp; +import com.alive.server.api.account.AccountSignUpReq; +import com.alive.server.api.account.InviteReq; +import com.alive.server.service.MemberService; +import com.alive.server.service.WalletService; +import com.alive.commons.annotation.Login; +import com.alive.db.entity.Vo.UserVo; +import com.alive.db.jooq.tables.pojos.TMemberPojo; +import com.alive.db.jooq.tables.records.ActivityLogRecord; +import com.alive.db.jooq.tables.records.TMemberRecord; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.sql.Timestamp; +import java.util.*; + +import static com.alive.db.jooq.Tables.*; + +@Slf4j +@RestController +@RequestMapping("/api/account") +@Api(tags = "账号相关") +@Transactional(isolation = Isolation.READ_COMMITTED) +@CrossOrigin(origins = "*") +public class AccountController { + + @Autowired + private DSLContext dslContext; + + @Autowired + private MemberService memberService; + + @Autowired + private WalletService walletService; + + @GetMapping("randomCode") + @ApiOperation("获取钱包签名串") + public UserVo randomCode(String account) { + Assert.isTrue(!StringUtils.isBlank(account), "Account not null"); + account = account.trim().toLowerCase(); + UserVo userVo = new UserVo(); + String sin = NumberUtil.getUUIDBy16()+"PASSWORD"; + userVo.setEncryptedString(sin); + RedisUtil.setEx(account,sin,60L); + return userVo; + } + + @GetMapping("exist") + @ApiOperation("检查账号是否注册") + public Map exist(String account,Integer chainType) { + Assert.isTrue(!StringUtils.isBlank(account), "Account not null"); + Assert.isTrue(chainType != null, "Chain not null"); + int count = dslContext.selectCount().from(T_MEMBER) + .where(T_MEMBER.FLAG.eq((byte) 1).and(T_MEMBER.ACCOUNT.eq(account.toLowerCase().trim()))) + .fetchAnyInto(Integer.class); + return Collections.singletonMap("exist", count > 0); + } + + @PostMapping("signUp") + @ApiOperation("注册") + public void signUp(@RequestBody @Validated AccountSignUpReq req) { + req.setAccount(req.getAccount().trim().toLowerCase()); + Assert.isTrue(RedisUtil.tryLock("AccountController.signUp." + req.getAccount(), 3), "operate too frequently"); + log.info(">>> 新用户注册 - {}", JsonUtil.toJson(req)); + + int count = dslContext.selectCount().from(T_MEMBER) + .where(T_MEMBER.FLAG.eq((byte) 1).and(T_MEMBER.ACCOUNT.eq(req.getAccount()))) + .fetchAnyInto(Integer.class); + Assert.isTrue(count == 0, "Account Exist"); + + if (req.getShareCode() == null || req.getShareCode().trim().isEmpty()) { + req.setShareCode("0"); + } + TMemberPojo referMember = null; + if(req.getShareCode() != null && !req.getShareCode().equals("0")){ + referMember = dslContext.select().from(T_MEMBER) + .where(T_MEMBER.FLAG.eq((byte) 1).and(T_MEMBER.SHARE_CODE.eq(req.getShareCode().toUpperCase()))) + .fetchAnyInto(TMemberPojo.class); + Assert.notNull(referMember, "Invalid Share Code"); + } + if(referMember == null){ + referMember = new TMemberPojo(); + referMember.setId(0); + referMember.setAllPid(","); + } + + //邀请码 + String shareCode = RandomStringUtils.random(6, true, true).toUpperCase(Locale.ROOT); + while (true) { + Integer tmp = dslContext.selectCount().from(T_MEMBER) + .where(T_MEMBER.SHARE_CODE.eq(shareCode)) + .fetchAnyInto(Integer.class); + if (tmp == 0) { + break; + } + shareCode = RandomStringUtils.random(6, true, true).toUpperCase(Locale.ROOT); + } + + //UID + String uid = "1" + RandomStringUtils.random(7, false, true).toUpperCase(Locale.ROOT); + while (true) { + Integer tmp = dslContext.selectCount().from(T_MEMBER) + .where(T_MEMBER.UID.eq(uid)) + .fetchAnyInto(Integer.class); + if (tmp == 0) { + break; + } + uid = "1" + RandomStringUtils.random(7, false, true).toUpperCase(Locale.ROOT); + } + TMemberRecord memberRecord = dslContext.newRecord(T_MEMBER); + memberRecord.setAccount(req.getAccount()); + memberRecord.setPasswordPay(""); + memberRecord.setPasswordLogin(Md5Util.encryptPassword(req.getPublicKey())); + memberRecord.setReferId(referMember.getId()); + memberRecord.setChainType(req.getChainType()); + memberRecord.setUid(uid); + memberRecord.setShareCode(shareCode); + memberRecord.store(); + + memberRecord.setAllPid(referMember.getAllPid() + memberRecord.getId() + ","); + memberRecord.store(); + walletService.initWallet(memberRecord.getId(),req.getAccount()); + + if(!referMember.getId().equals(0)){ + //更新团队 + List allPids = memberService.splitAllPid(memberRecord.getAllPid()); + dslContext.update(T_MEMBER) + .set(T_MEMBER.TEAM_NUM, T_MEMBER.TEAM_NUM.add(1)) + .where(T_MEMBER.ID.in(allPids)).execute(); + dslContext.update(T_MEMBER) + .set(T_MEMBER.SHARE_NUM, T_MEMBER.SHARE_NUM.add(1)) + .where(T_MEMBER.ID.eq(referMember.getId())).execute(); + }else{ + dslContext.update(T_MEMBER) + .set(T_MEMBER.TEAM_NUM, T_MEMBER.TEAM_NUM.add(1)) + .where(T_MEMBER.ID.in(memberRecord.getId())).execute(); + } + } + + @PostMapping("signIn") + @ApiOperation("登录") + public AccountSignInResp signIn(@RequestBody @Validated AccountSignInReq req) { + req.setAccount(req.getAccount().trim().toLowerCase()); + TMemberRecord memberRecord = dslContext.selectFrom(T_MEMBER) + .where(T_MEMBER.FLAG.eq((byte) 1) + .and(T_MEMBER.ACCOUNT.eq(req.getAccount()))).fetchAny(); + + ////todo 提示语国际化 + Assert.notNull(memberRecord, "Account Not Exist"); + String code = RedisUtil.get(req.getAccount()); + Assert.notNull(code, "signature error"); + + Assert.isTrue(req.getAccount() == null || EcRecoverUtil.checkEcRecover(code, req.getPassword(), req.getAccount()), "Bad Signature"); + + String redisKey = "iNode:loginToken:" + memberRecord.getId(); + String token = RedisUtil.get(redisKey); + if (token == null) { + token = JwtUtil.createJwtToken(memberRecord.getId().toString(), req.getAccount(), 86400L * 730L); + //30s 内的重复登录,返回同一个token + RedisUtil.setEx(redisKey, token, 30); + } + //校验一下是否有统计表 + walletService.verifyActivityStatisticsRecord(memberRecord.getAccount()); + AccountSignInResp resp = new AccountSignInResp(); + resp.setToken(token); + return resp; + } + + @Login + @PostMapping("bindingRelationship") + @ApiOperation("绑定邀请关系") + public Map bindingRelationship(@RequestBody @Validated InviteReq req){ + Map map = new HashMap<>(); + Integer memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + //邀请人 + TMemberPojo referMember = dslContext.select().from(T_MEMBER) + .where(T_MEMBER.FLAG.eq((byte) 1).and(T_MEMBER.SHARE_CODE.eq(req.getShareCode().toUpperCase()))) + .fetchAnyInto(TMemberPojo.class); + Assert.notNull(referMember, "Invalid Share Code"); + TMemberRecord tMemberRecord = memberService.fetchOne(memberId); + Assert.isTrue(tMemberRecord.getReferId().equals(0), "Non repeatable binding"); + Assert.isTrue(!memberId.equals(referMember.getId()), "You can't invite yourself"); + tMemberRecord.setReferId(referMember.getId()); + tMemberRecord.setAllPid(referMember.getAllPid() + memberId + ","); + tMemberRecord.store(); + + //查出我的全部下级人数、包含自己 + Integer countNumber = memberService.findTMemberRecordCount(memberId); + + //更新团队 + List allPids = memberService.splitAllPid(referMember.getAllPid()); + dslContext.update(T_MEMBER) + .set(T_MEMBER.TEAM_NUM, T_MEMBER.TEAM_NUM.add(countNumber)) + .where(T_MEMBER.ID.in(allPids)).execute(); + + dslContext.update(T_MEMBER) + .set(T_MEMBER.SHARE_NUM, T_MEMBER.SHARE_NUM.add(1)) + .where(T_MEMBER.ID.eq(referMember.getId())).execute(); + + //开始判断有没有做任务 + ActivityLogRecord activityLog = dslContext.selectFrom(ACTIVITY_LOG) + .where(ACTIVITY_LOG.ADDRESS.eq(tMemberRecord.getAccount()) + .and(ACTIVITY_LOG.CONFIG_TYPE.eq(9).and(ACTIVITY_LOG.TYPE.eq(1)))).fetchAny(); + if(activityLog != null){ + activityLog.setType(2); + activityLog.setEndTime(new Timestamp(System.currentTimeMillis())); + activityLog.store(); + //开始增加奖励统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(activityLog.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(activityLog.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(activityLog.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(activityLog.getSuperiorAddress())).execute(); + } + map.put("result",tMemberRecord.getReferId().equals(0) ? false : true); + return map; + } + + + @Login + @GetMapping("bindOrNot") + @ApiOperation("查询用户是否绑定关系") + public Map bindOrNot(){ + Map map = new HashMap<>(); + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + TMemberRecord tMemberRecord = memberService.fetchOne(memberId); + map.put("result",tMemberRecord.getReferId().equals(0) ? false : true); + return map; + } + + private static byte[] hexToByteArray(String s) { + int len = s.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + + Character.digit(s.charAt(i+1), 16)); + } + return data; + } + +} diff --git a/alive-api/src/main/java/com/alive/server/api/ActivityController.java b/alive-api/src/main/java/com/alive/server/api/ActivityController.java new file mode 100644 index 0000000..cf4049e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/ActivityController.java @@ -0,0 +1,73 @@ +package com.alive.server.api; + +import com.alive.server.api.account.ActivityReq; +import com.alive.server.api.account.ActivityTaskReq; +import com.alive.server.api.account.UserInviteReq; +import com.alive.commons.annotation.Login; +import com.alive.commons.model.BasePageReq; +import com.alive.db.entity.Vo.ActivityOutcomeVo; +import com.alive.db.entity.Vo.ActivityTaskVo; +import com.alive.db.entity.Vo.InviteCountVo; +import com.alive.db.entity.Vo.RankingSummaryVo; +import com.alive.server.service.ActivityService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + + +@Slf4j +@RestController +@RequestMapping("/api/activity") +@Api(tags = "活动相关") +@CrossOrigin(origins = "*") +public class ActivityController { + + @Autowired + private ActivityService activityService; + + @GetMapping("findActivityList") + @ApiOperation("查询活动列表") + public ActivityOutcomeVo findActivityList(ActivityReq activityReq) { + ActivityOutcomeVo activityOutcomeVo = new ActivityOutcomeVo(); + activityReq.setType(activityReq.getType() == null ? 1 : activityReq.getType()); + activityReq.setAddress(!StringUtils.isBlank(activityReq.getAddress()) ? activityReq.getAddress().toLowerCase() : null); + activityOutcomeVo.setActivityConfigVos(activityService.findActivityList(activityReq)); + activityService.countActivity(activityOutcomeVo,activityReq); + return activityOutcomeVo; + } + + @Login + @PostMapping("startTheTask") + @ApiOperation("开始活动任务") + public ActivityTaskVo startTheTask(@RequestBody @Validated ActivityTaskReq activityTaskReq) { + ActivityTaskVo activityOutcomeVo = new ActivityTaskVo(); + activityTaskReq.setAddress(!StringUtils.isBlank(activityTaskReq.getAddress()) ? activityTaskReq.getAddress().toLowerCase() : null); + activityService.startTheTask(activityOutcomeVo,activityTaskReq); + return activityOutcomeVo; + } + + + @Login + @GetMapping("invitation") + @ApiOperation("邀请页面") + public InviteCountVo invitation(UserInviteReq userInviteReq) { + InviteCountVo activityOutcomeVo = new InviteCountVo(); + Assert.notNull(userInviteReq.getAddress(), "address is null"); + userInviteReq.setAddress(!StringUtils.isBlank(userInviteReq.getAddress()) ? userInviteReq.getAddress().toLowerCase() : null); + activityService.invitation(activityOutcomeVo,userInviteReq.getAddress()); + return activityOutcomeVo; + } + + + @GetMapping("ranking") + @ApiOperation("排行榜") + public RankingSummaryVo ranking(BasePageReq req, UserInviteReq userInviteReq) { + userInviteReq.setAddress(!StringUtils.isBlank(userInviteReq.getAddress()) ? userInviteReq.getAddress().toLowerCase() : null); + return activityService.ranking(req,userInviteReq); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/CrowdfundingController.java b/alive-api/src/main/java/com/alive/server/api/CrowdfundingController.java new file mode 100644 index 0000000..4845d2d --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/CrowdfundingController.java @@ -0,0 +1,87 @@ +package com.alive.server.api; + +import com.alive.commons.annotation.Login; +import com.alive.commons.model.BasePageReq; +import com.alive.db.entity.Vo.*; +import com.alive.db.jooq.tables.records.CoinConfigRecord; +import com.alive.server.api.account.AccountSignInReq; +import com.alive.server.api.account.PayCoinReq; +import com.alive.server.api.account.PayNodeSmsReq; +import com.alive.server.api.account.TeskReq; +import com.alive.server.service.CrowdfundingService; +import com.alive.server.service.PersonalCenterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 众筹 + * + * @author HayDen + * @date 2024-05-24 + */ +@Slf4j +@RestController +@RequestMapping("/api/crowdfunding") +@Api(tags = "私募") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class CrowdfundingController +{ + @Autowired + private CrowdfundingService crowdfundingService; + + @GetMapping("contractAddress") + @ApiOperation("获取合约地址") + public Map contractAddress(){ + Map map = new HashMap<>(); + String address = crowdfundingService.contractAddress(); + map.put("address",address); + return map; + } + + @GetMapping("getPrivatePlacement") + @ApiOperation("查询私募信息") + public PrivatePlacementVo getPrivatePlacement(){ + return crowdfundingService.getPrivatePlacement(); + } + + @Login + @PostMapping("payOrder") + @ApiOperation("下单支付") + public PayCoinVo payOrder(@RequestBody @Validated PayCoinReq req){ + return crowdfundingService.payOrder(req); + } + + @Login + @PostMapping("claimTheAirdrop") + @ApiOperation("领取空投") + public Map claimTheAirdrop(){ + return crowdfundingService.claimTheAirdrop(); + } + + @GetMapping("getAirdropNumber") + @ApiOperation("查询可领取空投数量") + public Map getAirdropNumber(){ + Map map = new HashMap<>(); + map.put("result",crowdfundingService.getAirdropNumber()); + return map; + } + + @Login + @GetMapping("pay_private_placement") + @ApiOperation("支付通知") + public NoticeOfPaymentVo payPrivatePlacement(@Validated PayNodeSmsReq req){ + NoticeOfPaymentVo vo = new NoticeOfPaymentVo(); + Boolean result = crowdfundingService.payNodeSms(req); + return vo.setType(result ? 1 : 0); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/DiscordController.java b/alive-api/src/main/java/com/alive/server/api/DiscordController.java new file mode 100644 index 0000000..f76b814 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/DiscordController.java @@ -0,0 +1,76 @@ +package com.alive.server.api; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.util.IntegerUtil; +import com.alive.commons.util.RedisUtil; +import com.alive.server.config.DiscordConfig; +import com.alive.server.dto.UserDto; +import com.alive.server.service.DiscordService; +import com.alive.server.service.MemberService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +@Slf4j +@RestController +@RequestMapping("/api/discord") +@Api(tags = "discord服务") +@Transactional(isolation = Isolation.READ_COMMITTED) +@CrossOrigin(origins = "*") +public class DiscordController extends BaseComponent { + + @Autowired + private DiscordService discordService; + + @Autowired + private MemberService memberService; + + /** + * 授权回调地址 + * @param code + * @param state + * @return + */ + @GetMapping("authorizationCallbacksToken") + @ApiOperation("授权回调地址") + public Map authorizationCallbacksToken(String code,String state) { + //防止用户频繁请求授权 + String key = "AUTHORIZATIONCALLBACKSTOKEN"+state; + Integer value = IntegerUtil.getInteger(RedisUtil.get(key),0); + value = value + 1; + //防止用户频繁请求授权 + RedisUtil.setEx(key,value.toString(),60 * 3); + + Map map = new HashMap<>(); + try { + state = state.toLowerCase(); + //根据code换取token + discordService.getTokenByCode(code,state); + if(memberService.countDiscordUser(state) != 0){ + UserDto userDto = discordService.findUser(state); + //判断Discord是否已绑定 + discordService.bindUser(userDto.getId()); + memberService.renewalUserDiscord(state,userDto.getId()); + } + map.put("result",true); + }catch (Exception e){ + DiscordConfig.deleteAccessToken(state); + DiscordConfig.deleteRefreshToken(state); + Assert.isTrue(false,e.getMessage()); + } + return map; + } + +} + diff --git a/alive-api/src/main/java/com/alive/server/api/FileController.java b/alive-api/src/main/java/com/alive/server/api/FileController.java new file mode 100644 index 0000000..36c42e5 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/FileController.java @@ -0,0 +1,56 @@ +package com.alive.server.api; + +import com.alive.commons.annotation.Login; +import com.alive.commons.model.BaseResult; +import com.alive.server.api.file.FileModel; +import com.alive.server.provider.FileProvider; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("/api/file") +@CrossOrigin(origins = "*") +@Api(tags = "文件管理") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class FileController { + + @Autowired + private FileProvider fileProvider; + + @Login + @PostMapping("uploads") + @ApiOperation("多文件上传") + public List uploadFiles(@ApiParam("files") @Valid @NotNull(message = "文件不能为空") List files) throws IOException { + Assert.notNull(files, "多文件上传,参数为files"); + List respList = new ArrayList<>(files.size()); + for (MultipartFile file : files) { + respList.add(upload(file).getData()); + } + return respList; + } + + @Login + @PostMapping("upload") + @ApiOperation("单上传文件") + public BaseResult upload(@ApiParam("file") @Valid @NotNull(message = "文件不能为空") MultipartFile file) throws IOException { + return fileProvider.upload(file); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/InviteController.java b/alive-api/src/main/java/com/alive/server/api/InviteController.java new file mode 100644 index 0000000..384eba0 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/InviteController.java @@ -0,0 +1,59 @@ +package com.alive.server.api; + +import com.alive.commons.annotation.Login; +import com.alive.db.entity.Vo.InvitationCodeVo; +import com.alive.db.entity.Vo.InviteVo; +import com.alive.server.service.MemberService; +import com.alive.server.service.NodeSettingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 邀请相关数据 + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@RestController +@RequestMapping("/api/invite") +@Api(tags = "邀请数据查询") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class InviteController +{ + @Autowired + private NodeSettingService nodeSettingService; + + @Autowired + private MemberService memberService; + + + /*@Login + @GetMapping("getNodeSetting") + @ApiOperation("推荐人页面(废弃)") + public UserInviteVo findUserInviteVo(){ + return nodeSettingService.findUserInviteVo(); + }*/ + + @Login + @GetMapping("findInviteVoList") + @ApiOperation("查询邀请列表") + public List findInviteVoList(){ + return nodeSettingService.findInviteVoList(); + } + + @Login + @GetMapping("invitationCode") + @ApiOperation("查询用户邀请码") + public InvitationCodeVo invitationCode(){ + InvitationCodeVo code = memberService.invitationCode(); + return code; + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/NodeBuyLogController.java b/alive-api/src/main/java/com/alive/server/api/NodeBuyLogController.java new file mode 100644 index 0000000..01fefd1 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/NodeBuyLogController.java @@ -0,0 +1,123 @@ +package com.alive.server.api; + +import com.alive.server.api.account.PayNodeReq; +import com.alive.server.api.account.PayNodeSmsReq; +import com.alive.commons.annotation.Login; +import com.alive.commons.util.DateUtils; +import com.alive.commons.util.RedisUtil; +import com.alive.db.entity.NodeSetting; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.NoticeOfPaymentVo; +import com.alive.db.entity.Vo.WordNodeVo; +import com.alive.server.service.NodeBuyLogService; +import com.alive.server.service.NodeSettingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 节点认购记录Controller + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@RestController +@RequestMapping("/api/node") +@Api(tags = "节点购买页面") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class NodeBuyLogController +{ + @Autowired + private NodeSettingService nodeSettingService; + + @Autowired + private NodeBuyLogService nodeBuyLogService; + + + @GetMapping("contractAddress") + @ApiOperation("获取合约地址") + public Map contractAddress(){ + Map map = new HashMap<>(); + String address = nodeSettingService.contractAddress(); + map.put("address",address); + return map; + } + + @GetMapping("getNodeSetting") + @ApiOperation("获取节点列表") + public List getNodeSetting(){ + List nodeSettings = nodeSettingService.selectNodeSettingList(new NodeSetting().setStatus(1)); + return nodeSettings; + } + + @Login + @GetMapping("getOrderStateByHash") + @ApiOperation("通过hash查询是否购买成功") + public Map getOrderTypeByHash(String hash){ + Map map = new HashMap<>(); + map.put("nftIds", RedisUtil.get(hash)); + return map; + } + + @Login + @GetMapping("getWOrdNodePro") + @ApiOperation("查询我的盒子") + public List getWOrdNodePro(){ + List nodeVoList = nodeSettingService.getWOrdNodePro(); + for (WordNodeVo vo : nodeVoList){ + vo.setSpecialAmount("0"); + Date date = DateUtils.stringByDate("2024-05-07 23:59:59"); + Date datePas = DateUtils.stringByDate(vo.getCreateTime()); + if(datePas.getTime() < date.getTime()){ + vo.setSpecialAmount("38000"); + }else{ + vo.setSpecialAmount("10000"); + } + } + return nodeVoList; + } + + @Login + @GetMapping("getWOrdNode") + @ApiOperation("查询我的盒子(原接口)") + public WordNodeVo getWOrdNode(){ + return nodeBuyLogService.findWordNodeVo(); + } + + @Login + @PostMapping("pay_node") + @ApiOperation("节点下单") + public NodeBuyLog payNode(@RequestBody @Validated PayNodeReq req){ + NodeSetting nodeSetting = nodeSettingService.selectNodeSettingById(req.getNodeId()); + Assert.isTrue(nodeSetting != null, "Node is null"); + Assert.isTrue(req.getNumber() <= nodeSetting.getPurchaseLimit(), "Maxi mum pay limit"); + BigDecimal amount = nodeSetting.getNodePrice().multiply(new BigDecimal(req.getNumber())); + Assert.isTrue(amount.compareTo(req.getTatolAmount()) == 0, "Price error"); + //价格 + return nodeSettingService.payNode(nodeSetting,req); + } + + @Login + @GetMapping("pay_node_sms") + @ApiOperation("支付通知") + public NoticeOfPaymentVo payNodeSms(@Validated PayNodeSmsReq req){ + log.info("支付成功/失败通知:hash={},orderNumber={},status={}",req.getHash(),req.getOrderNumber(),req.getStatus()); + NoticeOfPaymentVo vo = new NoticeOfPaymentVo(); + Boolean result = nodeSettingService.payNodeSms(req); + return vo.setType(result ? 1 : 0); + } + +} diff --git a/alive-api/src/main/java/com/alive/server/api/TaskController.java b/alive-api/src/main/java/com/alive/server/api/TaskController.java new file mode 100644 index 0000000..6f4d3e6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/TaskController.java @@ -0,0 +1,67 @@ +package com.alive.server.api; + +import com.alive.commons.annotation.Login; +import com.alive.commons.model.BasePageReq; +import com.alive.db.entity.Vo.MyIntegralVo; +import com.alive.db.entity.Vo.NodeTaskVo; +import com.alive.db.entity.Vo.TaskVo; +import com.alive.server.api.account.TeskReq; +import com.alive.server.service.PersonalCenterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * 任务相关 + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@RestController +@RequestMapping("/api/task") +@Api(tags = "任务相关") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class TaskController +{ + @Autowired + private PersonalCenterService personalCenterService; + + @Login + @GetMapping("myBonusPoints") + @ApiOperation("我的积分") + public MyIntegralVo myBonusPoints(){ + MyIntegralVo myIntegralVo = personalCenterService.myBonusPoints(); + return myIntegralVo; + } + + @Login + @GetMapping("recommendedCompletionList") + @ApiOperation("推荐完成列表(分页)") + public List recommendedCompletionList(BasePageReq basePageReq){ + return personalCenterService.recommendedCompletionList(basePageReq); + } + + @Login + @GetMapping("nodeTask") + @ApiOperation("奥德赛任务") + public List nodeTask(){ + return personalCenterService.nodeTask(); + } + + + @Login + @PostMapping("taskReward") + @ApiOperation("领取任务奖励") + public Map taskReward(@RequestBody @Validated TeskReq req){ + return personalCenterService.taskReward(req); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/TestController.java b/alive-api/src/main/java/com/alive/server/api/TestController.java new file mode 100644 index 0000000..8bf0f9e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/TestController.java @@ -0,0 +1,84 @@ +package com.alive.server.api; + +import com.alive.db.entity.Vo.RecommendVo; +import com.alive.server.config.TwitterConfig; +import com.alive.server.oss.AliyunOssUtils; +import com.alive.server.oss.MultipartFileToFileUtil; +import com.alive.server.service.TwitterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Base64; +import java.util.Date; +import java.util.UUID; + +/** + * 个人中心 + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@RestController +@RequestMapping("/api/test") +@Api(tags = "测试数据") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class TestController +{ + @Autowired + private TwitterService twitterService; + + + /** + * 上传文件(阿里OSS) + * + * @param file 文件对象 + * @return + */ + @ApiOperation("上传文件") + @PostMapping("uploadFile") + @ResponseBody + public boolean uploadFile() { + String saveUrl = ""; + try { + log.info("------文件上传方法执行------"); + long startTime = System.currentTimeMillis(); + // 阿里OSS + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + // 阿里云API的文件夹名称(子文件夹) + String format = dateFormat.format(date) + "/"; + // 文件名 + String formats = String.valueOf(UUID.randomUUID()); + //File file = new File(""); + // MultipartFile 转 File + //File newFile = MultipartFileToFileUtil.multipartFileToFile(file); + File newFile = new File("\"F:\\shenzhencangku_m-wz95qgbprp4ppqnq93io_system.raw\""); + // 返回结果 resultArr[0]:唯一MD5数字签名 resultArr[1]:如:"appversion/20200723/a3662009-897c-43ea-a6d8-466ab8310c6b.apk" + String[] resultArr = AliyunOssUtils.uploadObject2OSS(newFile); + long endTime = System.currentTimeMillis(); + log.info("------文件上传成功,耗时" + ((endTime - startTime) / 1000) + "s------"); + return true; + } catch (Exception e) { + e.printStackTrace(); + log.info("------文件上传失败------"); + return true; + } + } + + + +} diff --git a/alive-api/src/main/java/com/alive/server/api/TwitterController.java b/alive-api/src/main/java/com/alive/server/api/TwitterController.java new file mode 100644 index 0000000..23199a6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/TwitterController.java @@ -0,0 +1,75 @@ +package com.alive.server.api; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.util.IntegerUtil; +import com.alive.commons.util.RedisUtil; +import com.alive.server.config.TwitterConfig; +import com.alive.server.dto.TwitterUserDto; +import com.alive.server.service.MemberService; +import com.alive.server.service.TwitterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +/** + * @anna_gosss + * Aabbcc567 + */ +@Slf4j +@RestController +@RequestMapping("/api/twitter") +@Api(tags = "推特") +@Transactional(isolation = Isolation.READ_COMMITTED) +@CrossOrigin(origins = "*") +public class TwitterController extends BaseComponent { + + @Autowired + private TwitterService twitterService; + + @Autowired + private MemberService memberService; + + @GetMapping("callbackUrl") + @ApiOperation("授权回调地址") + public Map callbackUrl(String state, String code) { + String key = "CALLBACKURL"+state; + Integer value = IntegerUtil.getInteger(RedisUtil.get(key),0); + value = value + 1; + //防止用户频繁请求授权 + RedisUtil.setEx(key,value.toString(),60 * 3); + + Map map = new HashMap<>(); + try { + state = state.toLowerCase(); + twitterService.requestBearerToken(state,code); + //更新用户推特信息 + if(memberService.countTwitterUser(state) == 0){ + //查询用户推特信息 + TwitterUserDto dto = twitterService.getUserInfoByToken(TwitterConfig.getAccessToken(state)); + //判断推特是否已绑定 + twitterService.bindUser(dto.getId()); + if(dto != null){ + memberService.renewalUserTwitter(dto,state); + } + } + map.put("result",true); + }catch (Exception e){ + TwitterConfig.deleteAccessToken(state); + TwitterConfig.deleteRefreshToken(state); + Assert.isTrue(false,e.getMessage()); + } + return map; + } +} + diff --git a/alive-api/src/main/java/com/alive/server/api/UserController.java b/alive-api/src/main/java/com/alive/server/api/UserController.java new file mode 100644 index 0000000..5d4effa --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/UserController.java @@ -0,0 +1,60 @@ +package com.alive.server.api; + +import com.alive.commons.annotation.Login; +import com.alive.db.entity.Vo.RecommendVo; +import com.alive.db.entity.Vo.TeamRewardVo; +import com.alive.server.service.PersonalCenterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 个人中心 + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@RestController +@RequestMapping("/api/user") +@Api(tags = "个人中心") +@Transactional(isolation = Isolation.READ_COMMITTED) +public class UserController +{ + @Autowired + private PersonalCenterService personalCenterService; + + @Login + @GetMapping("referralReward") + @ApiOperation("推荐奖励") + public RecommendVo referralReward(){ + RecommendVo recommendVo = personalCenterService.referralReward(); + return recommendVo; + } + + @Login + @GetMapping("teamList") + @ApiOperation("1级团队,2级团队") + public List teamList(Integer grade){ + Assert.notNull(grade, "Grade is null"); + return personalCenterService.findTeamRewardVoList(grade); + } + + @Login + @GetMapping("minerFittings") + @ApiOperation("组装矿机需要配件数量") + public Map minerFittings(){ + Map map = new HashMap<>(); + map.put("result",personalCenterService.minerFittings()); + return map; + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountCheckCodeReq.java b/alive-api/src/main/java/com/alive/server/api/account/AccountCheckCodeReq.java new file mode 100644 index 0000000..9e45df9 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountCheckCodeReq.java @@ -0,0 +1,39 @@ +package com.alive.server.api.account; + +import com.alive.commons.util.Md5Util; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AccountCheckCodeReq { + + @ApiModelProperty("1注册,2忘记密码,3转户,4注销账户,5修改密码,6修改支付密码") + private int type; + + @ApiModelProperty("账号") + private String account; + + private String code; + + @ApiModelProperty("当前时间戳,毫秒") + private long timestamp; + + @ApiModelProperty("签名内容,MD5(CHECK{mobile}{timestamp}DAPP)") + private String signature; + + public boolean checkSignature() { + if (code == null || code.length() != 6) { + return false; + } + if (account == null) { + return false; + } + if (timestamp == 1008610010L && "10000".equals(signature)) { + return true; + } + if (Math.abs(System.currentTimeMillis() - timestamp) > 600_000L) { + return false; + } + return Md5Util.md5(String.format("CHECK%s%dDAPP", account, timestamp)).equalsIgnoreCase(signature); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountGetCodeReq.java b/alive-api/src/main/java/com/alive/server/api/account/AccountGetCodeReq.java new file mode 100644 index 0000000..0a175d5 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountGetCodeReq.java @@ -0,0 +1,34 @@ +package com.alive.server.api.account; + +import com.alive.commons.util.Md5Util; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AccountGetCodeReq { + + @ApiModelProperty("1注册,2忘记密码,3修改账号,4注销账户,5修改密码,6修改支付密码") + private int type; + + @ApiModelProperty("邮箱、账号") + private String account; + + @ApiModelProperty("当前时间戳,毫秒") + private long timestamp; + + @ApiModelProperty("签名内容,MD5(CODE{mobile}{timestamp}DAPP)") + private String signature; + + public boolean checkSignature() { + if (account == null) { + return false; + } + if (timestamp == 1008610010L && "10000".equals(signature)) { + return true; + } + if (Math.abs(System.currentTimeMillis() - timestamp) > 600_000L) { + return false; + } + return Md5Util.md5(String.format("CODE%s%dDAPP", account, timestamp)).equalsIgnoreCase(signature); + } +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountSignInReq.java b/alive-api/src/main/java/com/alive/server/api/account/AccountSignInReq.java new file mode 100644 index 0000000..224e301 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountSignInReq.java @@ -0,0 +1,32 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class AccountSignInReq { + + @NotBlank + @ApiModelProperty("钱包地址") + private String account; + + @NotNull + @ApiModelProperty("密码或对MetaBird的签名结果") + private String password; + + + @NotNull + @ApiModelProperty("公钥") + private String publicKey; + + @NotNull + @ApiModelProperty("链类型:1=Bitcoin 2=Ethereum 3=Polygon 4=BNB Chain 5=Arbitrum One") + @Min(1) + @Max(5) + private Integer chainType; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountSignInResp.java b/alive-api/src/main/java/com/alive/server/api/account/AccountSignInResp.java new file mode 100644 index 0000000..72c999a --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountSignInResp.java @@ -0,0 +1,9 @@ +package com.alive.server.api.account; + +import lombok.Data; + +@Data +public class AccountSignInResp { + + private String token; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountSignUpReq.java b/alive-api/src/main/java/com/alive/server/api/account/AccountSignUpReq.java new file mode 100644 index 0000000..9b7cfb7 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountSignUpReq.java @@ -0,0 +1,27 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.*; + +@Data +public class AccountSignUpReq { + + @NotBlank + @ApiModelProperty("account") + private String account; + + @ApiModelProperty("invitation code") + private String shareCode; + + @NotBlank + @ApiModelProperty("publicKey") + private String publicKey; + + @NotNull + @ApiModelProperty("链类型:1=Bitcoin 2=Ethereum 3=Polygon 4=BNB Chain 5=Arbitrum One") + @Min(1) + @Max(5) + private Integer chainType; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountSubResp.java b/alive-api/src/main/java/com/alive/server/api/account/AccountSubResp.java new file mode 100644 index 0000000..9344ae9 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountSubResp.java @@ -0,0 +1,19 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class AccountSubResp { + + @ApiModelProperty("当前账号类型,0 普通账号,1主账号,2子账号") + private Integer subType; + + @ApiModelProperty("主账号信息,当前是子账号时有值") + private String mainAccount; + + @ApiModelProperty("子账号列表,仅在当前是主账号时有值") + private List subAccounts; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/AccountUpdatePasswordReq.java b/alive-api/src/main/java/com/alive/server/api/account/AccountUpdatePasswordReq.java new file mode 100644 index 0000000..75bc910 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/AccountUpdatePasswordReq.java @@ -0,0 +1,28 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Data +public class AccountUpdatePasswordReq { + + //@NotNull(message = "请输入手机号") + @ApiModelProperty("账号") + private String account; + + @Size(min = 6, max = 6, message = "please enter the correct verification code") + @ApiModelProperty("验证码") + private String code; + + ////@Size(min = 6, max = 20, message = "请按要求输入密码") + @NotNull(message = "Please enter your new password") + @ApiModelProperty("新密码") + private String password; + + ////@Size(min = 6, max = 20, message = "请按要求输入密码") + @ApiModelProperty("原密码") + private String oldPassword; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/ActivityReq.java b/alive-api/src/main/java/com/alive/server/api/account/ActivityReq.java new file mode 100644 index 0000000..7c8d747 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/ActivityReq.java @@ -0,0 +1,19 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; + +@Data +@Accessors(chain = true) +public class ActivityReq { + + @NotNull(message = "type is null") + @ApiModelProperty("1=社交活动 2=测试网络活动") + private Integer type; + + @ApiModelProperty("钱包地址") + private String address; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/ActivityTaskReq.java b/alive-api/src/main/java/com/alive/server/api/account/ActivityTaskReq.java new file mode 100644 index 0000000..ae883e7 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/ActivityTaskReq.java @@ -0,0 +1,27 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +@Accessors(chain = true) +public class ActivityTaskReq { + + @NotNull(message = "id is null") + @ApiModelProperty("活动ID") + private Integer id; + + @NotBlank(message = "address is null") + @ApiModelProperty("钱包地址") + private String address; + + + @NotNull(message = "type is null") + @ApiModelProperty("活动类型 1=推特 2=Discord 3=TG") + private String type; + +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/InviteReq.java b/alive-api/src/main/java/com/alive/server/api/account/InviteReq.java new file mode 100644 index 0000000..d4425fe --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/InviteReq.java @@ -0,0 +1,19 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +@Data +public class InviteReq { + + @NotBlank(message = "Please enter the invitation code") + @ApiModelProperty("invitation code") + private String shareCode; + + +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/NodeReq.java b/alive-api/src/main/java/com/alive/server/api/account/NodeReq.java new file mode 100644 index 0000000..ebe8d1f --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/NodeReq.java @@ -0,0 +1,15 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class NodeReq { + + @NotNull + @ApiModelProperty("节点id") + private Integer nodeId; + +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/PayCoinReq.java b/alive-api/src/main/java/com/alive/server/api/account/PayCoinReq.java new file mode 100644 index 0000000..1bdd648 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/PayCoinReq.java @@ -0,0 +1,25 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class PayCoinReq { + + @NotNull + @ApiModelProperty("币种ID") + private Integer coinId; + + @NotBlank + @ApiModelProperty("购买数量") + private String amount; + + /*@NotBlank + @ApiModelProperty("HASH") + private String hash;*/ +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/PayNodeReq.java b/alive-api/src/main/java/com/alive/server/api/account/PayNodeReq.java new file mode 100644 index 0000000..e505c31 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/PayNodeReq.java @@ -0,0 +1,26 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +@Data +public class PayNodeReq { + + @NotNull + @ApiModelProperty("节点id") + private Integer nodeId; + + @NotNull + @ApiModelProperty("购买数量") + @Min(value = 1) + private Integer number; + + @NotNull + @ApiModelProperty("金额") + private BigDecimal tatolAmount; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/PayNodeSmsReq.java b/alive-api/src/main/java/com/alive/server/api/account/PayNodeSmsReq.java new file mode 100644 index 0000000..d5a77bd --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/PayNodeSmsReq.java @@ -0,0 +1,23 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class PayNodeSmsReq { + + @NotBlank + @ApiModelProperty("订单号") + private String orderNumber; + + @ApiModelProperty("hash") + private String hash; + + @NotNull + @ApiModelProperty("1=支付成功 2=取消支付") + private Integer status; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/SubAccountModel.java b/alive-api/src/main/java/com/alive/server/api/account/SubAccountModel.java new file mode 100644 index 0000000..5dbe45f --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/SubAccountModel.java @@ -0,0 +1,11 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SubAccountModel { + + @ApiModelProperty("手机号") + private String mobile; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/TeskReq.java b/alive-api/src/main/java/com/alive/server/api/account/TeskReq.java new file mode 100644 index 0000000..e8042e6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/TeskReq.java @@ -0,0 +1,18 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class TeskReq { + + @NotNull + @ApiModelProperty("领取奖励id") + private Integer id; + +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/TwitterAuthorizationReq.java b/alive-api/src/main/java/com/alive/server/api/account/TwitterAuthorizationReq.java new file mode 100644 index 0000000..693dc70 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/TwitterAuthorizationReq.java @@ -0,0 +1,13 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TwitterAuthorizationReq { + + @ApiModelProperty("地址") + private String address; +} diff --git a/alive-api/src/main/java/com/alive/server/api/account/UserInviteReq.java b/alive-api/src/main/java/com/alive/server/api/account/UserInviteReq.java new file mode 100644 index 0000000..32efed4 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/account/UserInviteReq.java @@ -0,0 +1,17 @@ +package com.alive.server.api.account; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; + +@Data +@Accessors(chain = true) +public class UserInviteReq { + + @NotBlank(message = "Please enter the invitation address") + @ApiModelProperty("地址") + private String address; + +} diff --git a/alive-api/src/main/java/com/alive/server/api/file/FileModel.java b/alive-api/src/main/java/com/alive/server/api/file/FileModel.java new file mode 100644 index 0000000..f1569da --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/api/file/FileModel.java @@ -0,0 +1,18 @@ +package com.alive.server.api.file; + +import lombok.Data; + +@Data +public class FileModel { + //源文件名 + private String originFileName; + + //新文件名 + private String fileName; + + //文件相对路径 + private String filePath; + + //文件完整url + private String fullUrl; +} diff --git a/alive-api/src/main/java/com/alive/server/config/DcProperties.java b/alive-api/src/main/java/com/alive/server/config/DcProperties.java new file mode 100644 index 0000000..bf210c0 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/DcProperties.java @@ -0,0 +1,40 @@ +package com.alive.server.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "com.alive", ignoreUnknownFields = true) +public class DcProperties { + + private Config config = new Config(); + + private Upload upload = new Upload(); + + @Data + public static class Config { + + private String tokenHeader = "Authorization"; + + //登录token,redis key格式 + private String tokenRedisKeyFormat = "jiafu:token:%d:%s"; + + //token有效期,1天 + private long tokenExpireSeconds = 86400; + + //限制只能登录一个 + private boolean limitLoginOneOnly = false; + } + + @Data + public static class Upload { + + //文件存储根路径,需要以 / 结尾 + private String filePath = "/data/upload"; + + //默认域名 + private String defaultUrlPreFix = "http://localhost:8080/file/"; + } +} diff --git a/alive-api/src/main/java/com/alive/server/config/DiscordConfig.java b/alive-api/src/main/java/com/alive/server/config/DiscordConfig.java new file mode 100644 index 0000000..912968f --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/DiscordConfig.java @@ -0,0 +1,79 @@ +package com.alive.server.config; + +import com.alive.commons.util.RedisUtil; + +/** + * Discord相关配置 + */ +public class DiscordConfig { + + /** + * 客户id和客户私钥 + */ + public static final String CLIENT_ID = "1224903279029522605"; + public static final String CLIENT_SECRET = "6AWmmPdOOJTSx54ObO7s8EdCXQp-Kq4y"; + public static final String TOKEN_URL = "http://roos.nat300.top"; + //https://discord.com/channels/981752566729826424/1213733877152219196 + /** + * 用户服务器ID + */ + public static final String CHANNEL_ID = "981752566729826424"; + + /** + * 机器人token + */ + public static final String BOT_TOKEN = "MTIyNDkwMzI3OTAyOTUyMjYwNQ.GjEwjk.tqILxW6gC2E7WIziqtlV_iCe4VEW6M3ILUH1gQ"; + + + private static final String accessTokenCode = "DISCORD_ACCESS_TOKEN"; + private static final String accessRefreshTokenCode = "DISCORD_ACCESS_REFRESH_TOKEN"; + + /** + * 保存用户的访问令牌 + * @return + */ + public static void addAccessToken(String address,String token,Integer number){ + RedisUtil.setEx((accessTokenCode+address).toLowerCase(),token,number); + } + + /** + * 获取用户的访问令牌 + * @return + */ + public static String getAccessToken(String address){ + return RedisUtil.get((accessTokenCode+address).toLowerCase()); + } + + + /** + * 删除访问令牌 + * @param address + */ + public static void deleteAccessToken(String address){ + RedisUtil.del((accessTokenCode+address).toLowerCase()); + } + + /** + * 保存用户的刷新令牌 + * @return + */ + public static void addRefreshToken(String address,String token,Integer number){ + RedisUtil.setEx((accessRefreshTokenCode+address).toLowerCase(),token,number); + } + + /** + * 获取用户的刷新令牌 + * @return + */ + public static String getRefreshToken(String address){ + return RedisUtil.get((accessRefreshTokenCode+address).toLowerCase()); + } + + /** + * 删除刷新令牌 + * @param address + */ + public static void deleteRefreshToken(String address){ + RedisUtil.del((accessRefreshTokenCode+address).toLowerCase()); + } +} diff --git a/alive-api/src/main/java/com/alive/server/config/SwaggerConfig.java b/alive-api/src/main/java/com/alive/server/config/SwaggerConfig.java new file mode 100644 index 0000000..a1c1cf5 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/SwaggerConfig.java @@ -0,0 +1,66 @@ +package com.alive.server.config; + +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2 +@Profile({"dev", "test", "uat"}) +public class SwaggerConfig { + + @Bean + public Docket swaggerDocket() { + + List pars = new ArrayList<>(); + pars.add(buildParameter("Authorization", "全局参数,token", "header", null, false)); + pars.add(buildParameter("Accept-Language", "全局参数,语言,en,zh-CN", "header", null, false)); + pars.add(buildParameter("address", "全局参数,地址", "header", null, false)); + + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo( + new ApiInfoBuilder() + .title("INODE DOC") + .description("I NODE接口文档") + .version("1.0") + .build() + ).forCodeGeneration(true) + .select() + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .apis(RequestHandlerSelectors.basePackage("com.alive")) + .paths(PathSelectors.any()) + .build() + .directModelSubstitute(Timestamp.class, Long.class) + .directModelSubstitute(BigDecimal.class, String.class) + .directModelSubstitute(Long.class, String.class) + .directModelSubstitute(Time.class, String.class) + .globalOperationParameters(pars); + } + + private Parameter buildParameter(String name, String description, String type, String defaultValue, boolean required) { + return new ParameterBuilder() + .name(name) + .description(description) + .modelRef(new ModelRef("string")) + .parameterType(type) + .defaultValue(defaultValue) + .required(required) + .build(); + } +} diff --git a/alive-api/src/main/java/com/alive/server/config/TelegramConfig.java b/alive-api/src/main/java/com/alive/server/config/TelegramConfig.java new file mode 100644 index 0000000..3624ec5 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/TelegramConfig.java @@ -0,0 +1,49 @@ + +package com.alive.server.config; + +public class TelegramConfig { + + /** + * TG 机器人配置 + */ + /*public static final String TG_BOT_TOKEN = "6931894326:AAG7wKXz6KrT7VJEHRpNvRcbS6GAHPXFBfc"; + public static final String TG_BOT_NAME = "Roos_team_bot"; + + *//** + * 群聊ID + *//* + public static final String TG_BOT_TEAM_ID = "-1002057252647"; + + *//** + * 加入我们的URL + *//* + public static final String ADD_TG_URL = "https://t.me/roosnetwork"; + + + *//** + * 官网链接 + *//* + public static final String APP_TG_URL = "http://roos.nat300.top/";*/ + + /** + * TG 机器人配置 + */ + public static final String TG_BOT_TOKEN = "6824696533:AAGeZIB4nygsnhbNW8VKgOqNO3zM4eN9BcE"; + public static final String TG_BOT_NAME = "roos_001_bot"; + + /** + * 群聊ID + */ + public static final String TG_BOT_TEAM_ID = "-1002106880389"; + + /** + * 加入我们的URL + */ + public static final String ADD_TG_URL = "https://t.me/+DGP8zqISzag0ZmQ1"; + + + /** + * 官网链接 + */ + public static final String APP_TG_URL = "http://roos.nat300.top/"; +} diff --git a/alive-api/src/main/java/com/alive/server/config/ThreadPoolConstant.java b/alive-api/src/main/java/com/alive/server/config/ThreadPoolConstant.java new file mode 100644 index 0000000..8e83e51 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/ThreadPoolConstant.java @@ -0,0 +1,33 @@ +package com.alive.server.config; + +/** + * 线程池常量. + */ +public class ThreadPoolConstant { + + /** + * 核心线程数量 + */ + public static final int CORE_THREAD_NUM = 30; + + /** + * 最大线程数量 + */ + public static final int MAX_THREAD_NUM = 50; + + /** + * 非核心线程存活时间 + */ + public static final long KEEP_ALIVE_TIME_SECONDS = 10L; + + /** + * 任务队列长度 + */ + public static final int QUEUE_LENGTH = 100; + + /** + * 线程超时时间 + */ + public static final long TIME_OUT = 70; + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/config/TwitterConfig.java b/alive-api/src/main/java/com/alive/server/config/TwitterConfig.java new file mode 100644 index 0000000..cfb42f3 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/config/TwitterConfig.java @@ -0,0 +1,96 @@ +package com.alive.server.config; + +import com.alive.commons.util.RedisUtil; + +/** + * 推特相关配置 + */ +public class TwitterConfig { + + /** + * 客户id和客户私钥 + */ + public static final String CLIENT_ID = "ZjYyaEJNMHpfbjdEajhWbTE0MlM6MTpjaQ"; + public static final String CLIENT_SECRET = "n_SJAwD0a7en-JUmsAZrqomSVPZ7if7zCmYNu2OYODNPViCQq4"; + + /** + * 应用KYE和私钥 + */ + public static final String CONSUMER_KEY = "p095I87anDYwfiSVT8A6Yv6qS"; + public static final String CONSUMER_SECRET = "h53oVBl0EFoYDpBbiKe57qjVb0cIoTUoavGUYKUfiMCNHvbplw"; + + /** + * 应用的TOKEN + */ + public static final String ACCESS_TOKEN = "1744591442130161664-ooAeW9un4WvmzVLV6g6cFau8hAT4fz"; + public static final String ACCESS_TOKEN_SECRET = "7ysXLOGTUZUPV5ddVc0vDtHqt0y63vQrtL46tZ3XgMQO4"; + + /** + * 推特开发者账号的访问token + */ + public static final String AAAA_TOKEN = "AAAAAAAAAAAAAAAAAAAAAH3%2FswEAAAAAZPOg4zlVU6wpdP8vFUrgF8YDT04%3DfzNjjCrU4THOlwHqoR3WNLxFLhlKYayEel5nKXUhm0cwSXfpG1"; + + /** + * 回调地址 + */ + public static final String CALLBACK_URL="http://roos.nat300.top"; + + /** + * 开发者推特用户id + */ + public static final String DEVELOPERS = "1744591442130161664"; + + private static final String accessTokenCode = "TWITTER_ACCESS_TOKEN"; + private static final String accessRefreshTokenCode = "TWITTER_ACCESS_REFRESH_TOKEN"; + + + + /** + * 保存用户的访问令牌 + * @return + */ + public static void addAccessToken(String address,String token,Integer number){ + RedisUtil.setEx((accessTokenCode+address).toLowerCase(),token,number); + } + + /** + * 获取用户的访问令牌 + * @return + */ + public static String getAccessToken(String address){ + return RedisUtil.get((accessTokenCode+address).toLowerCase()); + } + + + /** + * 删除访问令牌 + * @param address + */ + public static void deleteAccessToken(String address){ + RedisUtil.del((accessTokenCode+address).toLowerCase()); + } + + /** + * 保存用户的刷新令牌 + * @return + */ + public static void addRefreshToken(String address,String token,Integer number){ + RedisUtil.setEx((accessRefreshTokenCode+address).toLowerCase(),token,number); + } + + /** + * 获取用户的刷新令牌 + * @return + */ + public static String getRefreshToken(String address){ + return RedisUtil.get((accessRefreshTokenCode+address).toLowerCase()); + } + + /** + * 删除刷新令牌 + * @param address + */ + public static void deleteRefreshToken(String address){ + RedisUtil.del((accessRefreshTokenCode+address).toLowerCase()); + } +} diff --git a/alive-api/src/main/java/com/alive/server/dto/AttentionDto.java b/alive-api/src/main/java/com/alive/server/dto/AttentionDto.java new file mode 100644 index 0000000..d72987a --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/AttentionDto.java @@ -0,0 +1,20 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class AttentionDto { + + /** + * true 表示关注成功 false 表示关注失败(目标用户没有公开推文的情况,因为他们必须批准关注者请求) + */ + private Boolean following; + + /** + * 指示目标用户是否需要批准关注请求。请注意,只有当目标用户批准传入的关注者请求时,经过身份验证的用户才会关注目标用户 false就是正常的 + */ + private Boolean pending_follow; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/DiscordTransshipmentDto.java b/alive-api/src/main/java/com/alive/server/dto/DiscordTransshipmentDto.java new file mode 100644 index 0000000..a643662 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/DiscordTransshipmentDto.java @@ -0,0 +1,36 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Accessors(chain = true) +public class DiscordTransshipmentDto{ + + private String discordId; + + private String tgId; + + private Integer id; + + private Integer activityConfigId; + + private String address; + + private Integer type; + + private BigDecimal amount; + + private Date createTime; + + private String mark; + + private BigDecimal superiorAmount; + + private Integer configType; + + private String superiorAddress; +} diff --git a/alive-api/src/main/java/com/alive/server/dto/DiscordUserDto.java b/alive-api/src/main/java/com/alive/server/dto/DiscordUserDto.java new file mode 100644 index 0000000..9c13d87 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/DiscordUserDto.java @@ -0,0 +1,30 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DiscordUserDto { + + /** + * 服务器ID + */ + private String guildId; + + /** + * 服务器名称 + */ + private String guildName; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户名称 + */ + private String userName; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/DiscordlaborUnionDto.java b/alive-api/src/main/java/com/alive/server/dto/DiscordlaborUnionDto.java new file mode 100644 index 0000000..923edec --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/DiscordlaborUnionDto.java @@ -0,0 +1,25 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 获取工会列表 + */ +@Data +@Accessors(chain = true) +public class DiscordlaborUnionDto { + + + /** + * 工会ID + */ + public String id; + + + /** + * 工会名称 + */ + public String name; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TransferDto.java b/alive-api/src/main/java/com/alive/server/dto/TransferDto.java new file mode 100644 index 0000000..8fe364b --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TransferDto.java @@ -0,0 +1,40 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +@Data +@Accessors(chain = true) +public class TransferDto { + + /** + * 任务log id + */ + private Integer id; + /** + * 用户地址 + */ + private String address; + /** + * 用户金额 + */ + private BigDecimal amount; + + /** + * 上级奖励用户金额 + */ + private BigDecimal superiorAmount; + + /** + * 上级地址 + */ + private String superiorAddress; + + /** + * 上级用户奖励地址 + */ + private Integer referId; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TransshipmentUserDto.java b/alive-api/src/main/java/com/alive/server/dto/TransshipmentUserDto.java new file mode 100644 index 0000000..6edcca2 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TransshipmentUserDto.java @@ -0,0 +1,25 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TransshipmentUserDto { + + /** + * 用户名 + */ + private String name; + + /** + * 用户id + */ + private String id; + + /** + * 用户名 @ + */ + private String username; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TwitterDto.java b/alive-api/src/main/java/com/alive/server/dto/TwitterDto.java new file mode 100644 index 0000000..332a756 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TwitterDto.java @@ -0,0 +1,20 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TwitterDto { + + /** + * 获取的访问令牌 + */ + private String accessToken; + + /** + * 刷新令牌 + */ + private String refreshToken; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TwitterThumbsUpDto.java b/alive-api/src/main/java/com/alive/server/dto/TwitterThumbsUpDto.java new file mode 100644 index 0000000..66d5f94 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TwitterThumbsUpDto.java @@ -0,0 +1,21 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TwitterThumbsUpDto { + + /** + * 喜欢的推文ID + */ + private String tweetsId; + + /** + * 推特ID + */ + private String teId; + + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TwitterTransshipmentDto.java b/alive-api/src/main/java/com/alive/server/dto/TwitterTransshipmentDto.java new file mode 100644 index 0000000..87535c3 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TwitterTransshipmentDto.java @@ -0,0 +1,35 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Accessors(chain = true) +public class TwitterTransshipmentDto{ + + private Integer id; + + + private Integer activityConfigId; + + private Date createTime; + + private String address; + + private Integer type; + + private BigDecimal amount; + + private BigDecimal superiorAmount; + + private Integer configType; + + private String mark; + + private String twitterId; + + private String superiorAddress; +} diff --git a/alive-api/src/main/java/com/alive/server/dto/TwitterUserDto.java b/alive-api/src/main/java/com/alive/server/dto/TwitterUserDto.java new file mode 100644 index 0000000..9b8f039 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/TwitterUserDto.java @@ -0,0 +1,29 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TwitterUserDto { + + /** + * 推特名 @xxxx + */ + private String username; + + /** + * 推特用户名 + */ + private String name; + + /** + * 推特用户ID + */ + private String id; + + /** + * 推特头像 + */ + private String img; +} diff --git a/alive-api/src/main/java/com/alive/server/dto/UserDto.java b/alive-api/src/main/java/com/alive/server/dto/UserDto.java new file mode 100644 index 0000000..1a762f6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/UserDto.java @@ -0,0 +1,21 @@ +package com.alive.server.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 用户工会信息 + */ +@Data +@Accessors(chain = true) +public class UserDto { + + private String id; + + private String username; + + private String locale; + + private String email; + +} diff --git a/alive-api/src/main/java/com/alive/server/dto/WalletOperation.java b/alive-api/src/main/java/com/alive/server/dto/WalletOperation.java new file mode 100644 index 0000000..7441ce6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/dto/WalletOperation.java @@ -0,0 +1,33 @@ +package com.alive.server.dto; + +import com.alive.commons.enums.WalletLogTypeEnum; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class WalletOperation { + + //类型: 1仅余额,2仅冻结 + private int type; + private int walletId; + private WalletLogTypeEnum opType; + private BigDecimal opAmount; + private String extRemark; + + private WalletOperation() { + } + + public static WalletOperation buildParam(int type, int walletId, + WalletLogTypeEnum opType, + BigDecimal opAmount, + String extRemark) { + WalletOperation dto = new WalletOperation(); + dto.type = type; + dto.walletId = walletId; + dto.opType = opType; + dto.opAmount = opAmount; + dto.extRemark = extRemark; + return dto; + } +} diff --git a/alive-api/src/main/java/com/alive/server/oss/AliyunOssUtils.java b/alive-api/src/main/java/com/alive/server/oss/AliyunOssUtils.java new file mode 100644 index 0000000..40b5d78 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/oss/AliyunOssUtils.java @@ -0,0 +1,432 @@ +package com.alive.server.oss; + +import com.aliyun.oss.ClientBuilderConfiguration; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.common.auth.CredentialsProvider; +import com.aliyun.oss.common.auth.DefaultCredentialProvider; +import com.aliyun.oss.model.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +@Slf4j +@Service +public class AliyunOssUtils { + + public static String endpoint = "https://oss-cn-shenzhen.aliyuncs.com"; + + // + public static String accessKeyId = "LTAI5t9qojLQd7XJ27SLtBvw"; + public static String accessKeySecret = "RVpT3A9bva47n71E2Pc4k5CI9fprzt"; + + // 创建阿里云登录凭证 + public static CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret); + + // 创建OSSClient实例。 + public static OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider); + + /** + * 创建bucket + */ + public static void createBucket(){ + String bucketName = "java-hello-world"; + try { + // 创建存储空间。 + ossClient.createBucket(bucketName); + } catch (Exception e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + /** + * 上传文件 + */ + public static void uploadFile(){ + // 填写Bucket名称,如果Bucket不存在, 可以先创建一个 + String bucketName = "java-hello-world"; + // 填写Object完整路径,需要包含文件名,但不用包含Bucket名称 + String objectName = "test/test.txt"; + + try { + String content = "Hello OSS"; + // 采用字节数组方式上传 + PutObjectResult putObjectResult = ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(content.getBytes())); + System.out.println("putObjectResult = " + putObjectResult.toString()); + } catch (Exception e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + + } + + /** + * 下载文件 + */ + public static void downloadFile(){ + // 填写Bucket名称 + String bucketName = "java-hello-world"; + // 填写Object完整路径,需要包含文件名,但不用包含Bucket名称 + String objectName = "test/test.txt"; + + try { + // 调用ossClient.getObject返回一个OSSObject实例,该实例包含文件内容及文件元信息。 + OSSObject ossObject = ossClient.getObject(bucketName, objectName); + + // 调用ossObject.getObjectContent获取文件输入流,可读取此输入流获取其内容。 + InputStream content = ossObject.getObjectContent(); + + if (content != null) { + BufferedReader reader = new BufferedReader(new InputStreamReader(content)); + while (true) { + String line = reader.readLine(); + if (line == null) { + break; + } + System.out.println("\n" + line); + } + // 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 + content.close(); + } + } catch (Exception e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + /** + * 查询某个bucket的Object列表 + */ + public static void getObjectList(){ + // 填写Bucket名称 + String bucketName = "java-hello-world"; + + try { + // ossClient.listObjects返回ObjectListing实例,包含此次listObject请求的返回结果。 + ObjectListing objectListing = ossClient.listObjects(bucketName); + + int size = objectListing.getObjectSummaries().size(); + System.out.println("=========查询到的对象数量是:"+size); + + // objectListing.getObjectSummaries获取所有文件的描述信息。 + for (OSSObjectSummary objectSummary : objectListing.getObjectSummaries()) { + System.out.println(" ======================== " + objectSummary.getKey() + " " + + "(size = " + objectSummary.getSize() + ")"); + } + } catch (Exception e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + + } + + /** + * 删除某个对象 + */ + public static void deleteObject(){ + // 填写Bucket名称 + String bucketName = "java-hello-world"; + // 填写Object完整路径,需要包含文件名,但不用包含Bucket名称 + String objectName = "test/test.txt"; + try { + // 删除文件 + ossClient.deleteObject(bucketName, objectName); + } catch (OSSException e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + + /** + * 获取阿里云OSS客户端对象 + * + * @return ossClient + */ + public static OSS getOSSClient() { + ClientBuilderConfiguration conf = new ClientBuilderConfiguration(); + // 连接空闲超时时间,超时则关闭 + conf.setIdleConnectionTime(1000); + // 在这里可以做一些配置,比如超时时间、最大连接数之类的 + return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret, conf); + } + + /** + * 创建桶 + * + * @param ossClient OSS连接 + * @param bucketName 桶名称 + * @return + */ + public static String createBucketName(OSS ossClient, String bucketName) { + if (!ossClient.doesBucketExist(bucketName)) { + //创建存储空间 + Bucket bucket = ossClient.createBucket(bucketName); + log.info("创建存储空间成功"); + return bucket.getName(); + } + return bucketName; + } + + + + /** + * 上传图片至OSS 文件流 + * + * @param ossClient oss连接 + * @param file 上传文件(文件全路径如:D:\\image\\cake.jpg) + * @param bucketName 桶名称 + * @param folder 阿里云API的文件夹名称(父文件夹) + * @param format 阿里云API的文件夹名称(子文件夹) + * @param formats 文件名 + * @return String 返回的唯一MD5数字签名 + */ + public static String[] uploadObject2OSS(File file) { + String bucketName= "shenzhencangku"; + createBucketName(ossClient,bucketName); + String folder= ""; + String format=""; + String formats="123"; + // 创建一个可重用固定线程数的线程池 + ExecutorService executorService = Executors.newFixedThreadPool(5); + String[] resultArr = new String[2]; + try { + // 分片上传 + folder = folder + format; + // 文件名 + String fileName = file.getName(); + // 文件扩展名 + String fileExtension = fileName.substring(fileName.lastIndexOf(".")); + // 最终文件名:UUID + 文件扩展名 + fileName = formats + fileExtension; + fileName = "shenzhencangku_m-wz95qgbprp4ppqnq93io_system.raw"; + // 上传路径 如:appversion/20200723/a3662009-897c-43ea-a6d8-466ab8310c6b.apk + // objectName表示上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg + String objectName = folder + fileName; + log.info("上传到路径:" + objectName); + // 文件大小 + long fileSize = file.length(); + // 创建上传Object的Metadata + ObjectMetadata metadata = new ObjectMetadata(); + // 指定该Object被下载时的网页的缓存行为 + metadata.setCacheControl("no-cache"); + // 指定该Object下设置Header + metadata.setHeader("Pragma", "no-cache"); + // 指定该Object被下载时的内容编码格式 + metadata.setContentEncoding("utf-8"); + // 文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成, + // 如果没有扩展名则填默认值application/octet-stream + metadata.setContentType(getContentType(fileExtension)); + // 指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称) + metadata.setContentDisposition("filename/filesize=" + fileName + "/" + fileSize + "Byte."); + // 创建InitiateMultipartUploadRequest对象 + InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucketName, objectName, metadata); + // 初始化分片 + InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request); + // 返回uploadId,它是分片上传事件的唯一标识,您可以根据这个uploadId发起相关的操作,如取消分片上传、查询分片上传等 + String uploadId = upresult.getUploadId(); + // partETags是PartETag的集合。PartETag由分片的ETag和分片号组成 + List partETags = Collections.synchronizedList(new ArrayList<>()); + // 计算文件有多少个分片 + final long maxPartCount = 10000; + final long fileLength = file.length(); + long partSize = 1 * 1024 * 1024L; // 初始分片大小为1MB + + // 计算分片数量,如果分片数量超过10000,则增大分片大小 + long partCount = (fileLength / partSize); + if (fileLength % partSize != 0) { + partCount++; + } + while (partCount > maxPartCount) { + partSize *= 2; // 将分片大小增加一倍 + partCount = (fileLength / partSize); + if (fileLength % partSize != 0) { + partCount++; + } + } + + if (partCount > 10000) { + throw new RuntimeException("分片总块数不能超过10000"); + } else { + log.info("分片总块数:" + partCount); + } + + // 遍历分片上传 + for (int i = 0; i < partCount; i++) { + long startPos = i * partSize; + long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize; + int partNumber = i + 1; + + // 实现并启动线程 + executorService.execute(new Runnable() { + @Override + public void run() { + InputStream inputStream = null; + try { + inputStream = new FileInputStream(file); + // 跳过已经上传的分片 + inputStream.skip(startPos); + UploadPartRequest uploadPartRequest = new UploadPartRequest(); + uploadPartRequest.setBucketName(bucketName); + uploadPartRequest.setKey(objectName); + uploadPartRequest.setUploadId(uploadId); + uploadPartRequest.setInputStream(inputStream); + // 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。 + uploadPartRequest.setPartSize(curPartSize); + // 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出这个范围,OSS将返回InvalidArgument的错误码。 + uploadPartRequest.setPartNumber(partNumber); + // 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。 + UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest); + // 每次上传分片之后,OSS的返回结果会包含一个PartETag。PartETag将被保存到PartETags中。 + synchronized (partETags) { + partETags.add(uploadPartResult.getPartETag()); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + } + }); + } + + // 等待所有的分片完成 + // shutdown方法:通知各个任务(Runnable)的运行结束 + executorService.shutdown(); + while (!executorService.isTerminated()) { + try { + // 指定的时间内所有的任务都结束的时候,返回true,反之返回false,返回false还有执行完的任务 + executorService.awaitTermination(5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + } + // 立即关闭所有执行中的线程 + // executorService.shutdownNow(); + + // 验证是否所有的分片都完成 + if (partETags.size() != partCount) { + throw new IllegalStateException("文件的某些部分上传失败!"); + } else { + log.info("文件上传成功:" + file.getName()); + } + // 完成分片上传 进行排序。partETags必须按分片号升序排列 + Collections.sort(partETags, new Comparator() { + @Override + public int compare(PartETag o1, PartETag o2) { + return o1.getPartNumber() - o2.getPartNumber(); + } + }); + // 创建CompleteMultipartUploadRequest对象 + // 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件 + CompleteMultipartUploadRequest completeMultipartUploadRequest = new CompleteMultipartUploadRequest(bucketName, objectName, uploadId, partETags); + // 设置文件访问权限 + // completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead); + // 完成上传 + CompleteMultipartUploadResult completeMultipartUploadResult = ossClient.completeMultipartUpload(completeMultipartUploadRequest); + if (completeMultipartUploadResult != null) { + // 解析结果 + resultArr[0] = completeMultipartUploadResult.getETag(); + resultArr[1] = objectName; + return resultArr; + } + } catch (Exception e) { + e.printStackTrace(); + log.error("上传阿里云OSS服务器异常." + e.getMessage(), e); + } finally { + // 关闭OSSClient + ossClient.shutdown(); + } + return null; + } + + /** + * 通过文件名判断并获取OSS服务文件上传时文件的contentType + * + * @param fileExtension 文件名扩展名 + * @return 文件的contentType + */ + public static String getContentType(String fileExtension) { + // 文件的后缀名 + if (".bmp".equalsIgnoreCase(fileExtension)) { + return "image/bmp"; + } + if (".gif".equalsIgnoreCase(fileExtension)) { + return "image/gif"; + } + if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) + || ".png".equalsIgnoreCase(fileExtension)) { + return "image/jpeg"; + } + if (".html".equalsIgnoreCase(fileExtension)) { + return "text/html"; + } + if (".txt".equalsIgnoreCase(fileExtension)) { + return "text/plain"; + } + if (".vsd".equalsIgnoreCase(fileExtension)) { + return "application/vnd.visio"; + } + if (".ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) { + return "application/vnd.ms-powerpoint"; + } + if (".doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) { + return "application/msword"; + } + if (".xml".equalsIgnoreCase(fileExtension)) { + return "text/xml"; + } + if (".mp4".equalsIgnoreCase(fileExtension)) { + return "video/mp4"; + } + // android + if (".apk".equalsIgnoreCase(fileExtension)) { + return "application/vnd.android.package-archive"; + } + // ios + if (".ipa".equals(fileExtension)) { + return "application/vnd.iphone"; + } + // 默认返回类型 + return "application/octet-stream"; + } + + public static void main(String[] args) throws Exception { + uploadFile(); +// downloadFile(); +// getObjectList(); +// deleteObject(); + } + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/oss/MultipartFileToFileUtil.java b/alive-api/src/main/java/com/alive/server/oss/MultipartFileToFileUtil.java new file mode 100644 index 0000000..3e82d14 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/oss/MultipartFileToFileUtil.java @@ -0,0 +1,71 @@ +package com.alive.server.oss; + +import org.springframework.web.multipart.MultipartFile; + +import java.io.*; + +/** + * 文件转换工具类 + * + * @author xiegege + * @date 2020-07-23 + */ +public class MultipartFileToFileUtil { + + /** + * MultipartFile 转 File + * + * @param file + * @throws Exception + */ + public static File multipartFileToFile(MultipartFile file) { + try { + File toFile; + if (file != null && file.getSize() > 0) { + InputStream ins = null; + ins = file.getInputStream(); + toFile = new File(file.getOriginalFilename()); + inputStreamToFile(ins, toFile); + ins.close(); + return toFile; + } + return null; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + /** + * 获取流文件 + * + * @param ins + * @param file + */ + public static void inputStreamToFile(InputStream ins, File file) { + try { + OutputStream os = new FileOutputStream(file); + int bytesRead; + byte[] buffer = new byte[8192]; + while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); + ins.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 删除本地临时文件 + * + * @param file + */ + public static void deleteTempFile(File file) { + if (file != null) { + File del = new File(file.toURI()); + del.delete(); + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/provider/FileProvider.java b/alive-api/src/main/java/com/alive/server/provider/FileProvider.java new file mode 100644 index 0000000..0e9079e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/provider/FileProvider.java @@ -0,0 +1,19 @@ +package com.alive.server.provider; + +import com.alive.server.api.file.FileModel; +import com.alive.commons.model.BaseResult; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +@FeignClient(name = "file-provider") +public interface FileProvider { + + @RequestMapping(value = "/api/file/upload", method = RequestMethod.POST, + consumes = MediaType.MULTIPART_FORM_DATA_VALUE, + produces = MediaType.APPLICATION_JSON_VALUE) + BaseResult upload(@RequestPart("file") MultipartFile file); +} diff --git a/alive-api/src/main/java/com/alive/server/service/ActivityService.java b/alive-api/src/main/java/com/alive/server/service/ActivityService.java new file mode 100644 index 0000000..ba912b1 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/ActivityService.java @@ -0,0 +1,381 @@ +package com.alive.server.service; + + +import com.alive.db.entity.Vo.*; +import com.alive.server.api.account.ActivityReq; +import com.alive.server.api.account.ActivityTaskReq; +import com.alive.server.api.account.UserInviteReq; +import com.alive.commons.model.BasePageReq; +import com.alive.commons.util.DateUtils; +import com.alive.commons.util.IntegerUtil; +import com.alive.commons.util.RedisUtil; +import com.alive.db.jooq.tables.records.ActivityConfigRecord; +import com.alive.db.jooq.tables.records.ActivityLogRecord; +import com.alive.db.jooq.tables.records.ActivityStatisticsRecord; +import com.alive.db.jooq.tables.records.TMemberRecord; +import com.alive.db.mapper.ActivityMapper; +import com.alive.server.config.DiscordConfig; +import com.alive.server.config.TelegramConfig; +import com.alive.server.config.TwitterConfig; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.*; + +import static com.alive.db.jooq.Tables.*; +import static com.sun.org.apache.xalan.internal.xsltc.compiler.Constants.CHARACTERS; + + +@Slf4j +@Service +public class ActivityService { + + @Autowired + private DSLContext dslContext; + + @Autowired + private TwitterService twitterService; + + @Autowired + private DiscordService discordService; + + @Autowired + private ActivityMapper activityMapper; + + /** + * 查询活动列表 + * @param activityReq + * @return + */ + public List findActivityList(ActivityReq activityReq) { + List activityConfigVos = dslContext.select(ACTIVITY_CONFIG.ID.as("id"),ACTIVITY_CONFIG.TITLE.as("title"),ACTIVITY_CONFIG.TITLE_CONTENT.as("titleContent"),ACTIVITY_CONFIG.ACTIVITY_IMG.as("activityImg") + ,ACTIVITY_CONFIG.ACTIVITY_URL.as("activityUrl"),ACTIVITY_CONFIG.AMOUNT.as("amount"),ACTIVITY_CONFIG.TYPE.as("type"),ACTIVITY_CONFIG.STATE.as("state") + ,ACTIVITY_CONFIG.ACTIVITY_NUMBER.as("activityNumber")) + .from(ACTIVITY_CONFIG).where(ACTIVITY_CONFIG.STATE.in(1,2) + .and(ACTIVITY_CONFIG.CATEGORY.eq(activityReq.getType()))).orderBy(ACTIVITY_CONFIG.ID.desc()).fetchInto(ActivityConfigVo.class); + if(StringUtils.isBlank(activityReq.getAddress())){ + activityConfigVos.forEach(config -> { + config.setActualAmount("0"); + config.setAmount(new BigDecimal(config.getAmount()).stripTrailingZeros().toPlainString()); + config.setState(4); + }); + }else{ + TMemberRecord tMemberRecord = dslContext.fetchOne(T_MEMBER, T_MEMBER.ACCOUNT.eq(activityReq.getAddress())); + Boolean invite = true; + if(tMemberRecord.getReferId() != null && tMemberRecord.getReferId() != 0){ + //已经绑定上级了,判断任务里面是否有绑定任务的数据 + Date date = DateUtils.stringByDate("2024-05-15 23:59:59"); + //以前绑定过上级的用户现在不在查询绑定邀请码这条任务数据了 + if(date.getTime() < System.currentTimeMillis()){ + invite = false; + } + } + if(!invite){ + activityConfigVos = dslContext.select(ACTIVITY_CONFIG.ID.as("id"),ACTIVITY_CONFIG.TITLE.as("title"),ACTIVITY_CONFIG.TITLE_CONTENT.as("titleContent"),ACTIVITY_CONFIG.ACTIVITY_IMG.as("activityImg") + ,ACTIVITY_CONFIG.ACTIVITY_URL.as("activityUrl"),ACTIVITY_CONFIG.AMOUNT.as("amount"),ACTIVITY_CONFIG.TYPE.as("type"),ACTIVITY_CONFIG.STATE.as("state") + ,ACTIVITY_CONFIG.ACTIVITY_NUMBER.as("activityNumber")) + .from(ACTIVITY_CONFIG).where(ACTIVITY_CONFIG.STATE.in(1,2).andNot(ACTIVITY_CONFIG.TYPE.eq(9)) + .and(ACTIVITY_CONFIG.CATEGORY.eq(activityReq.getType()))).orderBy(ACTIVITY_CONFIG.ID.desc()).fetchInto(ActivityConfigVo.class); + } + //一次性任务 + List configIds = new ArrayList<>(); + //每天可以做一次任务 + List configIds1 = new ArrayList<>(); + activityConfigVos.forEach(l -> { + l.setAmount(new BigDecimal(l.getAmount()).stripTrailingZeros().toPlainString()); + if(l.getActivityNumber().equals(-1)){ + configIds.add(l.getId()); + }else{ + configIds1.add(l.getId()); + } + }); + //查询一次性任务完成情况 + List logRecords = dslContext.select(ACTIVITY_LOG.ACTIVITY_CONFIG_ID,ACTIVITY_LOG.AMOUNT,ACTIVITY_LOG.TYPE,ACTIVITY_LOG.ID).from(ACTIVITY_LOG) + .where(ACTIVITY_LOG.ADDRESS.eq(activityReq.getAddress()).and(ACTIVITY_LOG.ACTIVITY_CONFIG_ID.in(configIds)) + .and(ACTIVITY_LOG.TYPE.in(1,2))).fetchInto(ActivityLogRecord.class); + Map configs = new HashMap<>(); + logRecords.forEach(l -> { + configs.put(l.getActivityConfigId(),l); + }); + + //获取当日的开始和结束时间 每天可以完成一次的任务 + LocalDateTime startOfDay = LocalDate.now().atStartOfDay(); + LocalDateTime endOfDay = LocalDate.now().atTime(LocalTime.MAX); + logRecords = dslContext.select(ACTIVITY_LOG.ACTIVITY_CONFIG_ID,ACTIVITY_LOG.AMOUNT,ACTIVITY_LOG.TYPE).from(ACTIVITY_LOG) + .where(ACTIVITY_LOG.ADDRESS.eq(activityReq.getAddress()).and(ACTIVITY_LOG.ACTIVITY_CONFIG_ID.in(configIds1)).and(ACTIVITY_LOG.TYPE.in(1,2)) + .and(ACTIVITY_LOG.END_TIME.between(Timestamp.valueOf(startOfDay),Timestamp.valueOf(endOfDay)))).fetchInto(ActivityLogRecord.class); + Map dayConfigs = new HashMap<>(); + logRecords.forEach(l -> { + dayConfigs.put(l.getActivityConfigId(),l); + }); + for (ActivityConfigVo con : activityConfigVos){ + if(con.getActivityNumber().equals(-1)){ + ActivityLogRecord log = configs.get(con.getId()); + if(log != null){ + con.setActualAmount(log.getAmount().stripTrailingZeros().toPlainString()); + con.setState(log.getType() == 1 ? 6 : 5); + } + }else{ + ActivityLogRecord log = dayConfigs.get(con.getId()); + if(log != null){ + con.setActualAmount(log.getAmount().stripTrailingZeros().toPlainString()); + con.setState(log.getType() == 1 ? 6 : 5); + } + } + if(con.getType().equals(9) && tMemberRecord.getReferId() != null && tMemberRecord.getReferId() != 0){ + con.setState(5); + } + } + } + return activityConfigVos; + } + + /** + * 统计活动参数数量 + * @param activityOutcomeVo + * @param activityReq + */ + public void countActivity(ActivityOutcomeVo activityOutcomeVo, ActivityReq activityReq) { + if(StringUtils.isBlank(activityReq.getAddress())){ + activityOutcomeVo.setAmount("0"); + }else{ + BigDecimal amount = dslContext.select(ACTIVITY_STATISTICS.AMOUNT.sum()).from(ACTIVITY_STATISTICS).where(ACTIVITY_STATISTICS.ADDRESS.eq(activityReq.getAddress())).fetchAnyInto(BigDecimal.class); + activityOutcomeVo.setAmount(amount == null ? "0" : amount.stripTrailingZeros().toPlainString()); + TMemberRecord user = dslContext.selectFrom(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(activityReq.getAddress())).fetchAny(); + Assert.notNull(user, "user is null"); + activityOutcomeVo.setCodePrompt(user.getCodePrompt()); + } + activityOutcomeVo.setUsesNumber(dslContext.selectCount().from("(SELECT COUNT(0) FROM activity_log WHERE type=3 GROUP BY address) as t").fetchAnyInto(Integer.class)); + } + + /** + * 开始活动任务 + * @param activityTaskReq + */ + @Transactional(isolation = Isolation.READ_COMMITTED,readOnly = false) + public void startTheTask(ActivityTaskVo activityOutcomeVo, ActivityTaskReq activityTaskReq) { + TMemberRecord user = dslContext.selectFrom(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(activityTaskReq.getAddress())).fetchAny(); + Assert.notNull(user, "please link your wallet first"); + if(user.getCodePrompt().equals(0)){ + dslContext.update(T_MEMBER).set(T_MEMBER.CODE_PROMPT,1).where(T_MEMBER.ACCOUNT.eq(activityTaskReq.getAddress())).execute(); + } + activityOutcomeVo.setType(1); + ActivityConfigRecord configRecord = dslContext.selectFrom(ACTIVITY_CONFIG).where(ACTIVITY_CONFIG.ID.eq(activityTaskReq.getId())).fetchAny(); + Assert.notNull(configRecord, "the active configuration does not exist"); + Assert.isTrue(configRecord.getState().equals(1),"the event does not exist or has been deactivated"); + if(configRecord.getActivityNumber().equals(-1)){ + Assert.isTrue(dslContext.selectCount().from(ACTIVITY_LOG).where(ACTIVITY_LOG.ADDRESS.eq(activityTaskReq.getAddress()) + .and(ACTIVITY_LOG.TYPE.eq(2)).and(ACTIVITY_LOG.ACTIVITY_CONFIG_ID.eq(configRecord.getId()))).fetchAnyInto(Integer.class) == 0, + "you have completed the task"); + }else{ + //获取当日的开始和结束时间 每天可以完成一次的任务 + LocalDateTime startOfDay = LocalDate.now().atStartOfDay(); + LocalDateTime endOfDay = LocalDate.now().atTime(LocalTime.MAX); + Assert.isTrue(dslContext.selectCount().from(ACTIVITY_LOG).where(ACTIVITY_LOG.ADDRESS.eq(activityTaskReq.getAddress()) + .and(ACTIVITY_LOG.TYPE.eq(2)).and(ACTIVITY_LOG.ACTIVITY_CONFIG_ID.eq(configRecord.getId())) + .and(ACTIVITY_LOG.END_TIME.between(Timestamp.valueOf(startOfDay),Timestamp.valueOf(endOfDay)))).fetchAnyInto(Integer.class) == 0, + "you have completed the task"); + } + activityOutcomeVo.setActivityUrl(configRecord.getActivityUrl()); + if(configRecord.getType().equals(9) && user.getReferId() != null && user.getReferId() != 0){ + Assert.isTrue(false,"you have bound a superior inviter"); + } + + //如果原来有未完成的直接失败处理 + dslContext.update(ACTIVITY_LOG).set(ACTIVITY_LOG.TYPE,3).where(ACTIVITY_LOG.ADDRESS.eq(activityTaskReq.getAddress()) + .and(ACTIVITY_LOG.TYPE.eq(1)).and(ACTIVITY_LOG.ACTIVITY_CONFIG_ID.eq(configRecord.getId()))).execute(); + + if(configRecord.getType() >= 1 && configRecord.getType() <= 5){ + //推特授权链接 + String accessToken = TwitterConfig.getAccessToken(activityTaskReq.getAddress()); + String refreshToken = TwitterConfig.getRefreshToken(activityTaskReq.getAddress()); + if(accessToken == null && refreshToken != null){ + //刷新令牌存在,直接使用刷新令牌刷新 + twitterService.requestBearerToken(activityTaskReq.getAddress(),null); + accessToken = TwitterConfig.getAccessToken(activityTaskReq.getAddress()); + refreshToken = TwitterConfig.getRefreshToken(activityTaskReq.getAddress()); + } + if(accessToken == null || refreshToken == null){ + //返回授权链接 + Assert.isTrue(IntegerUtil.getInteger(RedisUtil.get("CALLBACKURL"+activityTaskReq.getAddress()),0) < 3, + "frequent authorizations please try again later"); + String url = twitterService.getAuthorizationUrl(activityTaskReq.getAddress()+"+"+activityTaskReq.getType()); + activityOutcomeVo.setAuthorizationLinks(url); + } + } + //Discord 授权 + if(configRecord.getType().equals(6)){ + String accessToken = DiscordConfig.getAccessToken(activityTaskReq.getAddress()); + String refreshToken = DiscordConfig.getRefreshToken(activityTaskReq.getAddress()); + if(accessToken == null && refreshToken != null){ + //刷新令牌存在,直接使用刷新令牌刷新 + discordService.getTokenByCode(null,activityTaskReq.getAddress()); + accessToken = DiscordConfig.getAccessToken(activityTaskReq.getAddress()); + refreshToken = DiscordConfig.getRefreshToken(activityTaskReq.getAddress()); + } + if(accessToken == null || refreshToken == null){ + //返回授权链接 + Assert.isTrue(IntegerUtil.getInteger(RedisUtil.get("AUTHORIZATIONCALLBACKSTOKEN"+activityTaskReq.getAddress()),0) < 3, + "frequent authorizations please try again later"); + String url = discordService.getAuthorizationUrl(activityTaskReq.getAddress()+"+"+activityTaskReq.getType()); + activityOutcomeVo.setAuthorizationLinks(url); + } + } + //TG 链接 + if(configRecord.getType().equals(10)){ + String tgUrl = "https://t.me/"+ TelegramConfig.TG_BOT_NAME+"?start="+user.getAccount(); + activityOutcomeVo.setActivityUrl(tgUrl); + } + + //创建任务 + ActivityLogRecord log = dslContext.newRecord(ACTIVITY_LOG); + log.setActivityConfigId(configRecord.getId()); + log.setAddress(activityTaskReq.getAddress()); + log.setTitle(configRecord.getTitle()); + log.setType(1); + log.setMark(configRecord.getMark()); + log.setAmount(configRecord.getAmount()); + log.setSuperiorAmount(configRecord.getSuperiorAmount()); + if(user.getReferId() != null && user.getReferId() != 0){ + user = dslContext.selectFrom(T_MEMBER).where(T_MEMBER.ID.eq(user.getReferId())).fetchAny(); + log.setSuperiorAddress(user != null ? user.getAccount() : null); + }else{ + log.setSuperiorAmount(BigDecimal.ZERO); + } + log.setConfigType(configRecord.getType()); + log.store(); + } + + /** + * 查询邀请页面数据 + * @param activityOutcomeVo + * @param address + */ + public void invitation(InviteCountVo activityOutcomeVo, String address) { + TMemberRecord tMemberRecord = dslContext.selectFrom(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(address)).fetchAny(); + List users = dslContext.select().from(T_MEMBER).where(T_MEMBER.REFER_ID.eq(tMemberRecord.getId())).fetchInto(TMemberRecord.class); + activityOutcomeVo.setInvitationCode(tMemberRecord.getShareCode()); + activityOutcomeVo.setInvitationRewards(BigDecimal.ZERO); + activityOutcomeVo.setUserNumber(0); + if(users != null && users.size() > 0){ + Map map = new HashMap<>(); + users.forEach(u -> map.put(u.getAccount(),u)); + activityOutcomeVo.setUserNumber(users.size()); + BigDecimal amount = BigDecimal.ZERO; + List list = activityMapper.findInviteContributeVoList(map.keySet()); + Map mapInvite = new HashMap<>(); + list.forEach(m -> mapInvite.put(m.getAddress(),m)); + + List voList = new ArrayList<>(); + for (String key : map.keySet()){ + InviteContributeVo vo = mapInvite.get(key); + if(vo == null){ + vo = new InviteContributeVo(); + Integer lent = key.length(); + vo.setUserName(key.substring(0,5)+"...."+key.substring(lent-5,lent)); + voList.add(vo); + continue; + } + if(vo.getUserName().length() >= 20){ + Integer lent = vo.getUserName().length(); + vo.setUserName(vo.getUserName().substring(0,5)+"...."+vo.getUserName().substring(lent-5,lent)); + } + amount = amount.add(vo.getInvitationRewards()); + activityOutcomeVo.setInvitationRewards(amount); + voList.add(vo); + } + activityOutcomeVo.setInviteContributeVoList(voList); + } + } + + //查询排行榜 + public RankingSummaryVo ranking(BasePageReq req, UserInviteReq userInviteReq) { + RankingSummaryVo wordRanking = activityMapper.findRankingSummaryVo(userInviteReq.getAddress()); + if(wordRanking == null){ + wordRanking = new RankingSummaryVo(); + wordRanking.setAmount("0"); + }else{ + TMemberRecord tMemberRecord = dslContext.select().from(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(userInviteReq.getAddress())).fetchAnyInto(TMemberRecord.class); + wordRanking.setUserImg(tMemberRecord.getTwitterImg()); + wordRanking.setUserName(tMemberRecord.getTwitterUserName() == null ? tMemberRecord.getAccount() : tMemberRecord.getTwitterName()); + Integer lent = wordRanking.getUserName().length(); + wordRanking.setUserName(lent >= 20 ? wordRanking.getUserName().substring(0,5)+"...."+wordRanking.getUserName().substring(lent-5,lent) : wordRanking.getUserName()); + if(tMemberRecord.getReferId() != null && tMemberRecord.getReferId() != 0){ + tMemberRecord = dslContext.select(T_MEMBER.ACCOUNT,T_MEMBER.TWITTER_USER_NAME).from(T_MEMBER).where(T_MEMBER.ID.eq(tMemberRecord.getReferId())).fetchAnyInto(TMemberRecord.class); + wordRanking.setSuperior(tMemberRecord.getTwitterName() == null ? tMemberRecord.getAccount() : tMemberRecord.getTwitterName()); + lent = wordRanking.getSuperior().length(); + wordRanking.setSuperior(lent >= 20 ? wordRanking.getSuperior().substring(0,5)+"...."+wordRanking.getSuperior().substring(lent-5,lent) : wordRanking.getSuperior()); + } + wordRanking.setAmount(new BigDecimal(wordRanking.getAmount()).stripTrailingZeros().toPlainString()); + } + + List walletList = dslContext.selectFrom(ACTIVITY_STATISTICS) + .orderBy(ACTIVITY_STATISTICS.AMOUNT.desc(),ACTIVITY_STATISTICS.ID).limit(req.getOffset(),req.getSize()) + .fetchInto(ActivityStatisticsRecord.class); + + if(walletList == null || walletList.size() == 0){ + return wordRanking; + } + + Set addressSet = new HashSet<>(); + walletList.forEach(l -> { + addressSet.add(l.getAddress()); + }); + + List rankingVos = activityMapper.findRankingVoList(addressSet); + Map map = new HashMap<>(); + rankingVos.forEach(l -> map.put(l.getAddress(),l)); + List list = new ArrayList<>(); + for (ActivityStatisticsRecord record : walletList){ + RankingVo rankingVo = new RankingVo(); + rankingVo.setAddress(record.getAddress()); + rankingVo.setAmount(record.getAmount()); + RankingVo vo = map.get(record.getAddress()); + if(vo == null){ + continue; + } + Integer lent = vo.getUserName().length(); + rankingVo.setUserName(lent >= 20 ? vo.getUserName().substring(0,5)+"...."+vo.getUserName().substring(lent-5,lent) : vo.getUserName()); + rankingVo.setUserImg(vo.getUserImg()); + if(!StringUtils.isBlank(vo.getSuperior())){ + lent = vo.getSuperior().length(); + rankingVo.setSuperior(lent >= 20 ? vo.getSuperior().substring(0,5)+"...."+vo.getSuperior().substring(lent-5,lent) : vo.getSuperior()); + } + list.add(rankingVo); + } + wordRanking.setRankingVos(list); + return wordRanking; + } + + public static String generateRandomString(int length) { + Random random = new Random(); + StringBuilder stringBuilder = new StringBuilder(length); + for (int i = 0; i < length; i++) { + int randomIndex = random.nextInt(CHARACTERS.length()); + char randomChar = CHARACTERS.charAt(randomIndex); + stringBuilder.append(randomChar); + } + return stringBuilder.toString(); + } + + public void getActivityLog(String address) { + ActivityLogRecord activityLogRecord = dslContext.selectFrom(ACTIVITY_LOG).where(ACTIVITY_LOG.ADDRESS.eq(address) + .and(ACTIVITY_LOG.TYPE.eq(1)).and(ACTIVITY_LOG.CONFIG_TYPE.eq(8))).fetchAny(); + if(activityLogRecord != null){ + //增加用户资产统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(activityLogRecord.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(address)).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(activityLogRecord.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(activityLogRecord.getSuperiorAddress())).execute(); + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/AirTokenService.java b/alive-api/src/main/java/com/alive/server/service/AirTokenService.java new file mode 100644 index 0000000..37169f1 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/AirTokenService.java @@ -0,0 +1,36 @@ +package com.alive.server.service; + +import com.alive.server.web3.ContractEventHandle; +import org.springframework.stereotype.Service; +import org.web3j.abi.EventEncoder; +import org.web3j.protocol.core.methods.response.EthLog; + +import java.util.List; + +@Service +public class AirTokenService implements ContractEventHandle { + + final String TRANSFER_TOPIC = EventEncoder.buildEventSignature("Transfer(address,address,uint256)"); + + final String BUY_ROOS_SUCCESS = EventEncoder.buildEventSignature("BuyRoosSuccess(address,uint256,address,uint256,uint256,uint256[])"); + + final String BRIGADETOL2 = EventEncoder.buildEventSignature("BrigadeToL2(uint256,address)"); + + final String PAYMENTSUCCESS = EventEncoder.buildEventSignature("PaymentSuccess(address,uint256,uint256)"); + + + @Override + public String handle(EthLog.LogObject logObject, List dataList) { + if (logObject.getTopics().get(0).equalsIgnoreCase(TRANSFER_TOPIC)) { + return "Transfer"; + }else if(logObject.getTopics().get(0).equalsIgnoreCase(BUY_ROOS_SUCCESS)){ + return "BuyRoosSuccess"; + }else if(logObject.getTopics().get(0).equalsIgnoreCase(BRIGADETOL2)){ + return "BrigadeToL2"; + }else if(logObject.getTopics().get(0).equalsIgnoreCase(PAYMENTSUCCESS)){ + return "PaymentSuccess"; + } + return null; + } + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/service/AliDeliverService.java b/alive-api/src/main/java/com/alive/server/service/AliDeliverService.java new file mode 100644 index 0000000..008c519 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/AliDeliverService.java @@ -0,0 +1,55 @@ +package com.alive.server.service; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.*; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +/** + * 阿里快递查询 + */ +@Slf4j +@Service +public class AliDeliverService { + + //https://market.aliyun.com/products/57126001/cmapi023201.html + private static final String URL_FORMAT = "https://wdexpress.market.alicloudapi.com/gxali?n="; + + private static final String APP_CODE = "APPCODE fc28426b30bc4cd39e139efe6cd099ca"; + + @Autowired + private RestTemplate restTemplate; + + public JSONObject expressInfo(String expressNo, String recPhone) { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + headers.add("Authorization", APP_CODE); + + HttpEntity> requestEntity = new HttpEntity<>(headers); + + String url = URL_FORMAT + expressNo; + ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.GET, requestEntity, JSONObject.class); + JSONObject jsonObject = responseEntity.getBody(); + Assert.notNull(jsonObject, "暂无物流信息"); + + //-1:单号或快递公司代码错误, 0:暂无轨迹,1:快递收件,2:在途中,3:签收,4:问题件 5.疑难件 6.退件签收 + Integer state = jsonObject.getInteger("State"); + String reason = jsonObject.getString("Reason"); + Assert.isTrue(state >= 0, reason); + + //倒转物流日志 + JSONArray traces = jsonObject.getJSONArray("Traces"); + JSONArray newTraces = new JSONArray(); + int size = traces.size(); + for (int i = size - 1; i >= 0; i--) { + newTraces.add(traces.get(i)); + } + jsonObject.put("Traces", newTraces); + return jsonObject; + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/AliDySmsService.java b/alive-api/src/main/java/com/alive/server/service/AliDySmsService.java new file mode 100644 index 0000000..8ed26c6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/AliDySmsService.java @@ -0,0 +1,55 @@ +package com.alive.server.service; + +import com.aliyun.dysmsapi20170525.Client; +import com.aliyun.dysmsapi20170525.models.SendSmsRequest; +import com.aliyun.dysmsapi20170525.models.SendSmsResponse; +import com.aliyun.tea.TeaException; +import com.aliyun.teaopenapi.models.Config; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 阿里大鱼短信 + */ +@Slf4j +@Service +public class AliDySmsService { + + private static final String accessKeyId = "LTAI5t8jJ56kxGVZxNf4Ph38"; + private static final String accessKeySecret = "EgkRHJduyex5Ph0V9PwqhmsQsDJoGZ"; + private static final String signName = "官酝和合"; + private static final String templateCode = "SMS_223543777"; + private static final String endPoint = "dysmsapi.aliyuncs.com"; + + private static final Client client; + + static { + Config config = new com.aliyun.teaopenapi.models.Config() + .setAccessKeyId(accessKeyId) + .setAccessKeySecret(accessKeySecret); + config.endpoint = endPoint; + try { + client = new Client(config); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void sendSms(String mobile, String code) { + SendSmsRequest sendSmsRequest = new SendSmsRequest() + .setPhoneNumbers(mobile) + .setSignName(signName) + .setTemplateCode(templateCode) + .setTemplateParam("{\"code\":\"" + code + "\"}"); + + try { + SendSmsResponse response = client.sendSms(sendSmsRequest); + log.info("SendDySms {} - {}: {}", mobile, code, response.body.code); + } catch (TeaException error) { + com.aliyun.teautil.Common.assertAsString(error.message); + } catch (Exception _error) { + TeaException error = new TeaException(_error.getMessage(), _error); + com.aliyun.teautil.Common.assertAsString(error.message); + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/BscTimingService.java b/alive-api/src/main/java/com/alive/server/service/BscTimingService.java new file mode 100644 index 0000000..0579534 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/BscTimingService.java @@ -0,0 +1,268 @@ +package com.alive.server.service; + +import com.alive.commons.util.RedisUtil; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.TransactionDataVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.DefaultBlockParameter; +import org.web3j.protocol.core.methods.request.EthFilter; +import org.web3j.protocol.core.methods.response.EthLog; +import org.web3j.protocol.http.HttpService; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@Slf4j +@Service +public class BscTimingService { + + @Autowired + private AirTokenService airTokenService; + + @Autowired + private BtcBuyService btcBuyService; + + @Autowired + private NodeBuyLogService nodeBuyLogService; + + @Autowired + private ChainLogService chainLogService; + + @Autowired + private ActivityService activityService; + + private Web3j bscWsWeb3j; + + /** + * 初始化扫描 + */ + private boolean initializeScan = true; + + /** + * socket节点 + */ + @Value("${com.alive.chainWsUrl}") + private String chainWsUrl; + + /** + * 合约地址 + */ + @Value("${com.alive.contractUrl}") + private String contractUrl; + + public Web3j getBscWsWeb3j() { + if(bscWsWeb3j == null){ + bscWsWeb3j = Web3j.build(new HttpService(chainWsUrl)); + } + return bscWsWeb3j; + } + + /** + * 需要同步日志的合约 + * @return + */ + private List getAddresses() { + return Arrays.asList(contractUrl); + } + + + /** + * 获取初始块任务,需要注意控制时间,防止链上限制调用 + */ + public void printLogTask() { + String scannedBlockStr = RedisUtil.get("USDT:scannedBlock"); + if (scannedBlockStr == null || scannedBlockStr.isEmpty()) { + log.error(">>> 无已扫描数据,从20000块前开始"); + BigInteger latestBlock = new BigInteger(RedisUtil.get("USDT:latestBlock")); + scannedBlockStr = latestBlock.subtract(BigInteger.valueOf(20000)).toString(); + RedisUtil.set("USDT:scannedBlock", scannedBlockStr); + } + } + + /** + * 获取最新块 + */ + public void latestBlockTask() throws IOException { + BigInteger latestBlock = this.getBscWsWeb3j().ethBlockNumber().send().getBlockNumber(); + RedisUtil.set("USDT:latestBlock", latestBlock.toString()); + } + + private List scanBlock(BigInteger startBlock, BigInteger endBlock) { + EthFilter filter = new EthFilter(DefaultBlockParameter.valueOf(startBlock), + DefaultBlockParameter.valueOf(endBlock), + this.getAddresses()); + EthLog send = null; + try { + send = this.getBscWsWeb3j().ethGetLogs(filter).send(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e.getMessage()); + } + if(send.getError() != null && send.getError().getMessage() != null){ + log.info("扫描块失败(检查节点是否被限制) out {} ,{}, {}", startBlock, endBlock, send.getError().getMessage()); + return null; + } + return send.getLogs(); + } + + /** + * 此方法频繁调用会被限制频率 + * 此方法弥补订阅停止或者订阅漏掉区块补救措施 + */ + public void bscScanTask() { + //获取最新块 + try { + this.latestBlockTask(); + this.printLogTask(); + } catch (IOException e) { + } + BigInteger scannedBlock = new BigInteger(RedisUtil.get("USDT:scannedBlock")); + BigInteger latestBlock = new BigInteger(RedisUtil.get("USDT:latestBlock")); + BigInteger offset; + int times = 0; + if(initializeScan){ + //项目重启,扫描前60个区块 + scannedBlock = scannedBlock.subtract(new BigInteger("60")); + initializeScan = false; + } + while (latestBlock.subtract(scannedBlock).longValue() > 2 && times++ < 60) { + if (latestBlock.longValue() - scannedBlock.longValue() > 10000) { + offset = BigInteger.valueOf(500); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 1000) { + offset = BigInteger.valueOf(100); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 100) { + offset = BigInteger.valueOf(50); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 10) { + offset = BigInteger.valueOf(9); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 4) { + offset = BigInteger.valueOf(3); + } else { + offset = BigInteger.valueOf(1); + } + + if (latestBlock.subtract(scannedBlock).longValue() < offset.longValue()) { + break; + } + List resp = this.scanBlock(scannedBlock.add(BigInteger.ONE), scannedBlock.add(offset)); + if(resp == null){ + return; + } + if(resp != null && resp.size() > 0){ + for (EthLog.LogResult logItem : resp) { + this.handleLogEvent((EthLog.LogObject) logItem.get()); + } + } + scannedBlock = scannedBlock.add(offset); + RedisUtil.set("USDT:scannedBlock", scannedBlock.toString()); + } + } + + private synchronized void handleLogEvent(EthLog.LogObject logObject) { + if(RedisUtil.get(logObject.getBlockHash()) != null){ + //重复Hash,不予处理 + return; + } + //重复Hash10分钟过期 + RedisUtil.setEx(logObject.getBlockHash(),"1",60 * 10); + log.info("监听到数据HASH:{},块号:{},交易hash:{}",logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash()); + String data = logObject.getData().substring(2); + List dataList = new ArrayList<>(data.length() / 64); + //获取事件名称 + String even = airTokenService.handle(logObject, dataList); + String date = logObject.getData().substring(2,logObject.getData().length()); + //保存事件 + chainLogService.addChainLog(logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash(),even,date); + if(even != null && even.equals("BuyRoosSuccess")){ + //我的支付地址 + String address = this.getValue(date,0,true).toLowerCase(); + //我的付款金额 + BigDecimal amount = new BigDecimal(this.getValue(date,1,false)); + //上级地址 + String teamAddress = this.getValue(date,2,true).toLowerCase(); + //上级奖励金额 + BigDecimal teamAmount = new BigDecimal(this.getValue(date,3,false)); + //订单编号 + String orderNumber = this.getValue(date,4,false); + //NFT数量 + String nftNUmber = this.getValue(date,6,false); + Integer number = Integer.parseInt(nftNUmber); + List nftIds = new ArrayList<>(); + for (int i = 7; i < (7 + number); i++) { + //NFT的ID + String nftId = this.getValue(date,i,false); + if(nftId == null){ + break; + } + nftIds.add(Integer.parseInt(nftId)); + } + NodeBuyLog log = nodeBuyLogService.findNodeSubscribeByOrderNumber(orderNumber); + if(log == null){ + return; + } + log.setHash(logObject.getBlockHash()); + TransactionDataVo transactionDataVo = new TransactionDataVo(); + transactionDataVo.setFrom(address); + transactionDataVo.setPayAmount(amount); + transactionDataVo.setNftNumber(number); + transactionDataVo.setNftIds(nftIds); + transactionDataVo.setTeamAddress(teamAddress); + transactionDataVo.setTeamAmount(teamAmount); + transactionDataVo.setStatus(1); + btcBuyService.addNft(log,transactionDataVo); + }else if(even != null && even.equals("BrigadeToL2")){ + //我的支付地址 + String address = this.getValue(date,0,true).toLowerCase(); + //查询用户是否有未完成的任务 + activityService.getActivityLog(address); + } + + } + + + /** + * 查询日志里面加indexed的内容 + * @param topList 日志内容 + * @param code 查询第几个 + * @return + */ + public BigInteger getNmber(List topList,Integer code){ + String ret = topList.get(code); + ret = ret.substring(2,ret.length()); + //16进制转10进制 + return new BigInteger(ret, 16); + } + + /** + * 获取没有加indexed的内容 + * @param date 拆分的参数 + * @param code 取的位数 + * @param address 是否返回地址 + * @return + */ + public String getValue(String date, Integer code, Boolean address){ + int number = 64; + if(code == 0){ + date = date.substring(0,number); + }else{ + code = number * code; + date = date.substring(code,code+number); + } + if(date == null){ + return null; + } + if(address){ + return "0x"+date.substring(24,date.length()); + }else{ + return new BigInteger(date, 16).toString(); + } + } + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/service/BscWsService.java b/alive-api/src/main/java/com/alive/server/service/BscWsService.java new file mode 100644 index 0000000..fa6b83a --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/BscWsService.java @@ -0,0 +1,158 @@ +package com.alive.server.service; + +import com.alive.commons.util.RedisUtil; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.TransactionDataVo; +import io.reactivex.Flowable; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.web3j.protocol.core.methods.response.EthLog; +import org.web3j.protocol.core.methods.response.Log; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * 监听同步事件 + */ +@Slf4j +@Service +public class BscWsService{ + + @Autowired + private AirTokenService airTokenService; + + @Autowired + private BtcBuyService btcBuyService; + + @Autowired + private NodeBuyLogService nodeBuyLogService; + + @Autowired + private ChainLogService chainLogService; + + @Autowired + private ActivityService activityService; + + + /** + * 定义线程数,多少个线程同步socket + */ + ExecutorService executorService = Executors.newFixedThreadPool(2); + + public void wsExec(Flowable flowable){ + flowable.subscribe(log -> { + if(log != null){ + executorService.execute(() -> handleLogEvent((EthLog.LogObject) log)); + } + },throwable -> { + System.out.printf("错误-------"+ throwable.getMessage()); + }); + } + + private synchronized void handleLogEvent(EthLog.LogObject logObject) { + if(RedisUtil.get(logObject.getBlockHash()) != null){ + //重复Hash,不予处理 + return; + } + //重复Hash10分钟过期 + RedisUtil.setEx(logObject.getBlockHash(),"1",60 * 10); + log.info("监听到数据HASH:{},块号:{},交易hash:{}",logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash()); + String data = logObject.getData().substring(2); + List dataList = new ArrayList<>(data.length() / 64); + //获取事件名称 + String even = airTokenService.handle(logObject, dataList); + String date = logObject.getData().substring(2,logObject.getData().length()); + //保存事件 + chainLogService.addChainLog(logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash(),even,date); + if(even != null && even.equals("BuyRoosSuccess")){ + //我的支付地址 + String address = this.getValue(date,0,true).toLowerCase(); + //我的付款金额 + BigDecimal amount = new BigDecimal(this.getValue(date,1,false)); + //上级地址 + String teamAddress = this.getValue(date,2,true).toLowerCase(); + //上级奖励金额 + BigDecimal teamAmount = new BigDecimal(this.getValue(date,3,false)); + //订单编号 + String orderNumber = this.getValue(date,4,false); + //NFT数量 + String nftNUmber = this.getValue(date,6,false); + Integer number = Integer.parseInt(nftNUmber); + List nftIds = new ArrayList<>(); + for (int i = 7; i < (7 + number); i++) { + //NFT的ID + String nftId = this.getValue(date,i,false); + if(nftId == null){ + break; + } + nftIds.add(Integer.parseInt(nftId)); + } + NodeBuyLog log = nodeBuyLogService.findNodeSubscribeByOrderNumber(orderNumber); + if(log == null){ + return; + } + log.setHash(logObject.getBlockHash()); + TransactionDataVo transactionDataVo = new TransactionDataVo(); + transactionDataVo.setFrom(address); + transactionDataVo.setPayAmount(amount); + transactionDataVo.setNftNumber(number); + transactionDataVo.setNftIds(nftIds); + transactionDataVo.setTeamAddress(teamAddress); + transactionDataVo.setTeamAmount(teamAmount); + transactionDataVo.setStatus(1); + btcBuyService.addNft(log,transactionDataVo); + }else if(even != null && even.equals("BrigadeToL2")){ + //我的支付地址 + String address = this.getValue(date,0,true).toLowerCase(); + //查询用户是否有未完成的任务 + activityService.getActivityLog(address); + } + + } + + + /** + * 查询日志里面加indexed的内容 + * @param topList 日志内容 + * @param code 查询第几个 + * @return + */ + public BigInteger getNmber(List topList,Integer code){ + String ret = topList.get(code); + ret = ret.substring(2,ret.length()); + //16进制转10进制 + return new BigInteger(ret, 16); + } + + /** + * 获取没有加indexed的内容 + * @param date 拆分的参数 + * @param code 取的位数 + * @param address 是否返回地址 + * @return + */ + public String getValue(String date, Integer code, Boolean address){ + int number = 64; + if(code == 0){ + date = date.substring(0,number); + }else{ + code = number * code; + date = date.substring(code,code+number); + } + if(date == null){ + return null; + } + if(address){ + return "0x"+date.substring(24,date.length()); + }else{ + return new BigInteger(date, 16).toString(); + } + } + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/service/BtcBuyService.java b/alive-api/src/main/java/com/alive/server/service/BtcBuyService.java new file mode 100644 index 0000000..06b8881 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/BtcBuyService.java @@ -0,0 +1,231 @@ +package com.alive.server.service; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alive.commons.config.BaseComponent; +import com.alive.commons.util.DateUtils; +import com.alive.commons.util.HttpUtils; +import com.alive.commons.util.RedisUtil; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.TransactionDataVo; +import com.alive.db.jooq.tables.records.NodeRecord; +import com.alive.db.mapper.NodeSettingMapper; +import com.alive.server.web3.Web3jServer; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +import static com.alive.db.jooq.Tables.NODE; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@Service +public class BtcBuyService extends BaseComponent +{ + @Autowired + private NodeBuyLogService nodeBuyLogService; + + @Autowired + private NodeNftConfigService nodeNftConfigService; + + @Resource + private NodeSettingMapper nodeSettingMapper; + + @Autowired + private Web3jServer web3jServer; + + /** + * 检查是否支付成功 + */ + public void exec() { + List nodeSubscribes = nodeBuyLogService.selectNodeSubscribeList(new NodeBuyLog().setStatus(1)); + if(nodeSubscribes != null && nodeSubscribes.size() > 0){ + for (NodeBuyLog nodeSubscribe : nodeSubscribes){ + if(DateUtils.addMinute(nodeSubscribe.getCreateTime(),30).getTime() < System.currentTimeMillis()){ + nodeSubscribe.setStatus(4); + nodeSubscribe.setIllustrate("订单创建超过30分钟未支付"); + nodeBuyLogService.updateOrAddNodeSubscribe(nodeSubscribe); + } + } + } + nodeSubscribes = nodeBuyLogService.selectNodeSubscribeList(new NodeBuyLog().setStatus(2)); + for (NodeBuyLog nodeSubscribe : nodeSubscribes){ + log.info("开始确认链上用户购买情况,订单ID:{}---------------------------------",nodeSubscribe.getId()); + //通过hash查询链上数据 + TransactionDataVo transactionDataVo = null; + try { + transactionDataVo = web3jServer.getEthLogsByHash(nodeSubscribe.getHash()); + } catch (IOException e) { + RedisUtil.setEx(nodeSubscribe.getHash(),"0",30); + nodeSubscribe.setIllustrate("订单hash数据异常"); + nodeSubscribe.setStatus(4); + nodeBuyLogService.updateOrAddNodeSubscribe(nodeSubscribe); + log.info("订单确认失败:{}---------------------------------",nodeSubscribe.getId()); + continue; + } + if(transactionDataVo == null){ + continue; + } + this.addNft(nodeSubscribe,transactionDataVo); + } + } + + /** + * 铸造NFT + * @param nodeSubscribe 订单信息 + * @param transactionDataVo 铸造链上信息 + */ + public void addNft(NodeBuyLog nodeSubscribe,TransactionDataVo transactionDataVo){ + //订单与链上数据对比 + this.dataVerify(nodeSubscribe,transactionDataVo); + log.info("本次订单数据确认结果是:{}---------------------------------",nodeSubscribe.getStatus()); + String nftIds = ""; + if(nodeSubscribe.getStatus() == 3){ + for (Integer nftId : transactionDataVo.getNftIds()){ + nftIds += "#"+nftId+" "; + //支付成功 + NodeRecord nodeRecord = dslContext.newRecord(NODE); + nodeRecord.setId(nftId); + nodeRecord.setNodeSettingId(nodeSubscribe.getNodeSettingId()); + nodeRecord.setBuyCoin(nodeSubscribe.getPayCoin()); + nodeRecord.setBuyAmount(nodeSubscribe.getBuyAmount().divide(new BigDecimal(nodeSubscribe.getBuyCount()),4,BigDecimal.ROUND_HALF_UP)); + nodeRecord.setBuyNumber(1); + nodeRecord.setNodeName(nodeSubscribe.getNodeName()); + nodeRecord.setConfirmTime(new Timestamp(System.currentTimeMillis())); + nodeRecord.setUserId(nodeSubscribe.getUserId()); + nodeRecord.setOrderNumber(nodeSubscribe.getOrderNumber()); + nodeRecord.store(); + } + //开始给上级发放奖励 + nodeNftConfigService.reward(nodeSubscribe); + //减少库存 + nodeSettingMapper.addInventory(nodeSubscribe.getBuyCount(),nodeSubscribe.getNodeSettingId(),nodeSubscribe.getBuyAmount()); + } + if(nodeSubscribe.getStatus() != 2){ + nodeBuyLogService.updateOrAddNodeSubscribe(nodeSubscribe); + } + //订单超过2小时无法确认,直接失败处理 + if(nodeSubscribe.getStatus() == 2 && DateUtils.addMinute(nodeSubscribe.getCreateTime(),30).getTime() < System.currentTimeMillis()){ + nodeSubscribe.setStatus(4); + nodeSubscribe.setIllustrate("订单链上确认超过30分钟,直接取消"); + nodeBuyLogService.updateOrAddNodeSubscribe(nodeSubscribe); + } + if(nodeSubscribe.getStatus().equals(4) || nodeSubscribe.getStatus().equals(3)){ + RedisUtil.setEx(nodeSubscribe.getHash(),nodeSubscribe.getStatus().equals(4) ? "0" : nftIds,30); + } + } + + /** + * 开始对比链上数据是否正确 + * @param nodeSubscribe + * @param transactionDataVo + */ + public void dataVerify(NodeBuyLog nodeSubscribe,TransactionDataVo transactionDataVo){ + BigDecimal limit = new BigDecimal("1000000"); + transactionDataVo.setTeamAmount(transactionDataVo.getTeamAmount().divide(limit)); + transactionDataVo.setPayAmount(transactionDataVo.getPayAmount().divide(limit)); + String address0x = "0x0000000000000000000000000000000000000000"; + if(transactionDataVo.getTeamAddress().equals(address0x)){ + transactionDataVo.setTeamAddress("0"); + } + if(transactionDataVo.getStatus() == null || transactionDataVo.getStatus().equals(-1)){ + //链上确认中 + return; + } + if(transactionDataVo.getStatus().equals(0)){ + nodeSubscribe.setIllustrate("链上失败"); + nodeSubscribe.setStatus(4); + return; + } + if(!nodeSubscribe.getTeamAddress().equals("0") && nodeSubscribe.getRebate().compareTo(BigDecimal.ZERO) != 0){ + if(!transactionDataVo.getTeamAddress().equals("0") && nodeSubscribe.getRebate().compareTo(transactionDataVo.getTeamAmount()) != 0){ + nodeSubscribe.setIllustrate("上级奖励金额不一致"); + nodeSubscribe.setStatus(4); + return; + } + if(nodeSubscribe.getTeamAddress().compareTo(transactionDataVo.getTeamAddress()) != 0){ + nodeSubscribe.setIllustrate("上级地址奖励不一致"); + nodeSubscribe.setStatus(4); + return; + } + } + if(transactionDataVo.getPayAmount().compareTo(nodeSubscribe.getBuyAmount()) != 0){ + nodeSubscribe.setIllustrate("支付金额不一致"); + nodeSubscribe.setStatus(4); + return; + } + if(!transactionDataVo.getFrom().equals(nodeSubscribe.getWalletAddress())){ + nodeSubscribe.setIllustrate("支付地址不一致"); + nodeSubscribe.setStatus(4); + } + if(!transactionDataVo.getNftNumber().equals(nodeSubscribe.getBuyCount())){ + nodeSubscribe.setIllustrate("NFT铸造数量不一致"); + nodeSubscribe.setStatus(4); + }else{ + nodeSubscribe.setIllustrate("铸造成功"); + nodeSubscribe.setStatus(3); + } + } + + public Boolean httpContractByHash(NodeBuyLog nodeSubscribe,BigDecimal scope,String configAddress){ + if(nodeSubscribe.getHash() == null){ + nodeSubscribe.setStatus(4); + }else{ + String hash = nodeSubscribe.getHash(); + String value = HttpUtils.sendGet("https://blockchain.info/rawtx/"+hash); + if(StringUtils.isBlank(value)){ + return true; + } + JSONObject qu = JSONObject.parseObject(value, JSONObject.class); + //获取到交易数据 + if(qu.get("block_index") == null || qu.get("block_height") == null){ + //区块未确认 + return false; + } + //交易发起数据 + JSONArray inputs = qu.getJSONArray("inputs"); + JSONObject inputsValue = inputs.getJSONObject(0).getJSONObject("prev_out"); + { + //出账地址 + String address = inputsValue.get("addr").toString().toLowerCase(); + nodeSubscribe.setInputAddress(address); + nodeSubscribe.setStatus(3); + } + { + JSONArray out = qu.getJSONArray("out"); + JSONObject outUser = out.getJSONObject(0); + //收款地址 + String address = outUser.get("addr").toString().toLowerCase(); + + //出账金额 + String inpAmount = outUser.get("value").toString(); + //放大计算 + if(new BigDecimal(inpAmount).compareTo(nodeSubscribe.getBuyAmount().multiply(scope)) != 0){ + nodeSubscribe.setStatus(4); + } + nodeSubscribe.setOutAddress(address); + if(!configAddress.equals(address)){ + //收款地址不对 + nodeSubscribe.setStatus(4); + } + //收款金额 + //String outAmount = outUser.get("value").toString(); + //手续费 + //JSONObject outUserFee = out.getJSONObject(1); + //String fee = outUserFee.get("value").toString(); + } + } + return true; + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/ChainLogService.java b/alive-api/src/main/java/com/alive/server/service/ChainLogService.java new file mode 100644 index 0000000..0689dd4 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/ChainLogService.java @@ -0,0 +1,29 @@ +package com.alive.server.service; + +import com.alive.db.jooq.tables.records.ChainLogRecord; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigInteger; + +import static com.alive.db.jooq.Tables.CHAIN_LOG; + +@Service +public class ChainLogService +{ + @Autowired + private DSLContext dslContext; + + + public void addChainLog(String hash, BigInteger blockNumber,String transactionHash, String even, String date) + { + ChainLogRecord chainLogRecord = dslContext.newRecord(CHAIN_LOG); + chainLogRecord.setHash(hash); + chainLogRecord.setBlockNumber(blockNumber.toString()); + chainLogRecord.setChainName(even); + chainLogRecord.setDataValue(date); + chainLogRecord.setTransactionHash(transactionHash); + chainLogRecord.store(); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/CodeService.java b/alive-api/src/main/java/com/alive/server/service/CodeService.java new file mode 100644 index 0000000..d207bbe --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/CodeService.java @@ -0,0 +1,71 @@ +package com.alive.server.service; + +import com.alive.commons.util.RedisUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.RandomStringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +@Slf4j +@Service +public class CodeService { + + @Autowired + private DingService dingService; + + @Autowired + private AliDySmsService aliDySmsService; + + @Value("${spring.profiles.active}") + private String env; + + private final static String PRE_FIX_FORMAT = "juxing:chapter:%d:%s"; + private final static long EXPIRE_TIME = 600; + private final static int TYPE = 0; + + public void send(String mobile, int type) { + String code = RedisUtil.get(String.format(PRE_FIX_FORMAT, TYPE, mobile)); + long ttl = -1; + if (code != null) { + ttl = RedisUtil.ttl(String.format(PRE_FIX_FORMAT, TYPE, mobile)); + Assert.isTrue(ttl < 500, "发送过于频繁"); + } + if (ttl < 200) { + //如果验证码小于200s过期,更换验证码 + code = RandomStringUtils.random(6, false, true); + } + RedisUtil.setEx(String.format(PRE_FIX_FORMAT, TYPE, mobile), code, EXPIRE_TIME); + log.info("发送验证码:{} - {}", mobile, code); + if ("prod".equals(env)) { + aliDySmsService.sendSms(mobile, code); + return; + } + String content = "【官酝和合】您的验证码是" + code + "。如非本人操作,请忽略本短信"; + //dingService.sendMsg(mobile, content); + } + + public boolean check(String mobile, int type, String code) { + String saved = RedisUtil.get(String.format(PRE_FIX_FORMAT, TYPE, mobile)); + if (saved == null || code == null) { + return false; + } + if ("000000".equals(code) && !env.equals("prod")) { + return true; + } + return code.equals(saved); + } + + public boolean checkAndDel(String mobile, int type, String code) { + if (!check(mobile, TYPE, code)) { + return false; + } + del(mobile); + return true; + } + + public void del(String mobile) { + RedisUtil.del(String.format(PRE_FIX_FORMAT, TYPE, mobile)); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/CrowdfundingService.java b/alive-api/src/main/java/com/alive/server/service/CrowdfundingService.java new file mode 100644 index 0000000..2cb58a2 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/CrowdfundingService.java @@ -0,0 +1,464 @@ +package com.alive.server.service; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.enums.WalletLogTypeEnum; +import com.alive.commons.model.BasePageReq; +import com.alive.commons.util.*; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.*; +import com.alive.db.jooq.tables.pojos.SysConfigPojo; +import com.alive.db.jooq.tables.records.*; +import com.alive.db.mapper.NodeSettingMapper; +import com.alive.db.mapper.PersonalCenterMapper; +import com.alive.server.api.account.PayCoinReq; +import com.alive.server.api.account.PayNodeSmsReq; +import com.alive.server.api.account.TeskReq; +import com.alive.server.dto.WalletOperation; +import com.alive.server.web3.Web3jServer; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.annotation.OrderUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import org.web3j.abi.datatypes.Int; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.DefaultBlockParameter; +import org.web3j.protocol.core.methods.request.EthFilter; +import org.web3j.protocol.core.methods.response.EthLog; +import org.web3j.protocol.http.HttpService; + +import javax.annotation.Resource; +import java.io.IOException; +import java.lang.reflect.Member; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Timestamp; +import java.util.*; + +import static com.alive.db.jooq.Tables.*; + +@Slf4j +@Service +public class CrowdfundingService extends BaseComponent { + + @Autowired + private MemberService memberService; + + @Autowired + private WalletService walletService; + + @Autowired + private ChainLogService chainLogService; + + @Autowired + private AirTokenService airTokenService; + + /** + * 合约地址 + */ + @Value("${com.alive.contractUrl}") + private String contractUrl; + + /** + * 初始化扫描 + */ + private boolean initializeScan = true; + + @Autowired + private Web3jServer web3jServer; + + public Web3j getBscWsWeb3j() { + return web3jServer.getWeb3j(); + } + + /** + * 需要同步日志的合约 + * @return + */ + private List getAddresses() { + return Arrays.asList(contractUrl); + } + + + public Boolean payNodeSms(PayNodeSmsReq req) { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + PayCoinLogRecord payCoinLogRecord = dslContext.select().from(PAY_COIN_LOG).where(PAY_COIN_LOG.STATUS.eq(1)) + .and(PAY_COIN_LOG.MEMBER_ID.eq(memberId)).and(PAY_COIN_LOG.ORDER_NUMBER.eq(req.getOrderNumber())).fetchAnyInto(PayCoinLogRecord.class); + Assert.isTrue(payCoinLogRecord != null && payCoinLogRecord.getStatus().equals(1), "Order error"); + if (req.getStatus().equals(2)) { + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.STATUS,4).set(PAY_COIN_LOG.ILLUSTRATE,"取消订单") + .where(PAY_COIN_LOG.ID.eq(payCoinLogRecord.getId())).execute(); + return true; + } + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.HASH,req.getHash()) + .where(PAY_COIN_LOG.ID.eq(payCoinLogRecord.getId())).execute(); + return true; + } + + public PrivatePlacementVo getPrivatePlacement() { + PrivatePlacementVo privatePlacementVo = new PrivatePlacementVo(); + List coins = dslContext.select().from(COIN_CONFIG).where(COIN_CONFIG.STATE.eq(1)).fetchInto(CoinConfigRecord.class); + if(coins != null && coins.size() > 0){ + CoinConfigRecord coin = coins.get(0); + privatePlacementVo.setUsdtPrice(coin.getUsdtPrice().stripTrailingZeros().toPlainString()); + privatePlacementVo.setMinNumber(coin.getMinNumber().stripTrailingZeros().toPlainString()); + privatePlacementVo.setPrivatePlacement(coin.getPrivatePlacement().stripTrailingZeros().toPlainString()); + privatePlacementVo.setToPrivatePlacement(coin.getToPrivatePlacement().stripTrailingZeros().toPlainString()); + privatePlacementVo.setCoinId(coin.getId()); + } + if(StringUtils.isBlank(RequestUtil.getToken())){ + privatePlacementVo.setWordPrivatePlacement("0"); + privatePlacementVo.setWordAirdrop("0"); + return privatePlacementVo; + } + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + List walletRecords = dslContext.select().from(T_MEMBER_WALLET).where(T_MEMBER_WALLET.MEMBER_ID.eq(memberId)).fetchInto(TMemberWalletRecord.class); + for (TMemberWalletRecord memberWalletRecord : walletRecords){ + if(memberWalletRecord.getCoinId().equals(1)){ + privatePlacementVo.setWordPrivatePlacement(memberWalletRecord.getBalance().add(memberWalletRecord.getFrozen()).stripTrailingZeros().toPlainString()); + }else if(memberWalletRecord.getCoinId().equals(2)){ + privatePlacementVo.setWordAirdrop(memberWalletRecord.getBalance().add(memberWalletRecord.getFrozen()).stripTrailingZeros().toPlainString()); + } + } + return privatePlacementVo; + } + + + /** + * 用户下单 + * @param req + * @return + */ + public PayCoinVo payOrder(PayCoinReq req) { + BigDecimal amount = new BigDecimal(req.getAmount()); + CoinConfigRecord configRecord = dslContext.select().from(COIN_CONFIG).where(COIN_CONFIG.ID.eq(req.getCoinId())).fetchAnyInto(CoinConfigRecord.class); + Assert.isTrue(configRecord != null, "Coin config is null"); + Assert.isTrue(amount.compareTo(configRecord.getMinNumber()) >= 0 && amount.compareTo(configRecord.getMaxNumber()) <= 0, "Minimum or maximum purchase quantity limits"); + Assert.isTrue(configRecord.getPrivatePlacement().subtract(configRecord.getToPrivatePlacement()).subtract(amount).compareTo(BigDecimal.ZERO) >= 0, "Insufficient inventory"); + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + TMemberRecord tMemberRecord = memberService.fetchOne(memberId); + PayCoinLogRecord payCoinLogRecord = dslContext.newRecord(PAY_COIN_LOG); + payCoinLogRecord.setMemberId(tMemberRecord.getId()); + payCoinLogRecord.setAddress(tMemberRecord.getAccount()); + payCoinLogRecord.setCoinName(configRecord.getCoinName()); + payCoinLogRecord.setUnitPrice(configRecord.getUsdtPrice()); + payCoinLogRecord.setAmount(amount); + payCoinLogRecord.setPayUsdt(amount.multiply(configRecord.getUsdtPrice())); + payCoinLogRecord.setStatus(1); + payCoinLogRecord.setOrderNumber(NumberUtil.getUUIDBy16()); + payCoinLogRecord.setCoinId(configRecord.getId()); + payCoinLogRecord.setCoinName(configRecord.getCoinName()); + payCoinLogRecord.store(); + PayCoinVo payCoinVo = new PayCoinVo(); + payCoinVo.setOrderNumber(payCoinLogRecord.getOrderNumber()); + payCoinVo.setUsdtAmount(payCoinLogRecord.getPayUsdt().multiply(new BigDecimal("1000000000000000000"))); + return payCoinVo; + } + + /** + * 众筹确认是否支付成功 + */ + public void exec() { + List payCoinLogRecords = dslContext.select().from(PAY_COIN_LOG).where(PAY_COIN_LOG.STATUS.eq(1)).fetchInto(PayCoinLogRecord.class); + List payCoinLogRecordList = new ArrayList<>(); + if(payCoinLogRecords != null && payCoinLogRecords.size() > 0){ + for (PayCoinLogRecord nodeSubscribe : payCoinLogRecords){ + if(DateUtils.addMinute(nodeSubscribe.getCreateTime(),30).getTime() < System.currentTimeMillis()){ + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.STATUS,4).set(PAY_COIN_LOG.ILLUSTRATE,"订单创建超过30分钟未支付") + .where(PAY_COIN_LOG.ID.eq(nodeSubscribe.getId())).execute(); + continue; + } + payCoinLogRecordList.add(nodeSubscribe); + } + } + for (PayCoinLogRecord payCoinLogRecord : payCoinLogRecordList){ + if(payCoinLogRecord.getHash() == null){ + continue; + } + log.info("开始确认链上用户购买情况,订单ID:{}---------------------------------",payCoinLogRecord.getId()); + //通过hash查询链上数据 + PayCoinVo payCoinVo = null; + try { + payCoinVo = web3jServer.crowdfundingByHash(payCoinLogRecord.getHash()); + } catch (IOException e) { + RedisUtil.setEx(payCoinLogRecord.getHash(),"0",30); + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.STATUS,4).set(PAY_COIN_LOG.ILLUSTRATE,"订单hash数据异常") + .where(PAY_COIN_LOG.ID.eq(payCoinLogRecord.getId())).execute(); + + log.info("订单确认失败:{}---------------------------------",payCoinLogRecord.getId()); + continue; + } + if(payCoinVo == null){ + continue; + } + this.addPrivatePlacement(payCoinLogRecord,payCoinVo); + } + } + + + /** + * 私募 + * @param nodeSubscribe 订单信息 + * @param transactionDataVo 铸造链上信息 + */ + public void addPrivatePlacement(PayCoinLogRecord nodeSubscribe,PayCoinVo transactionDataVo){ + //订单与链上数据对比 + this.dataVerify(nodeSubscribe,transactionDataVo); + log.info("本次订单数据确认结果是:{}---------------------------------",nodeSubscribe.getStatus()); + String nftIds = ""; + if(nodeSubscribe.getStatus() == 3){ + //入账 + TMemberWalletRecord walletRecord= walletService.getWallet(nodeSubscribe.getMemberId(), nodeSubscribe.getCoinId()); + WalletOperation walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.PRIVATE_PLACEMENT,nodeSubscribe.getAmount(),"私募"); + walletService.operateBalance(walletOperation); + //减少库存 + dslContext.update(COIN_CONFIG).set(COIN_CONFIG.TO_PRIVATE_PLACEMENT,COIN_CONFIG.TO_PRIVATE_PLACEMENT.add(nodeSubscribe.getAmount())) + .where(COIN_CONFIG.ID.eq(nodeSubscribe.getCoinId())).execute(); + } + if(nodeSubscribe.getStatus() != 2){ + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.STATUS,nodeSubscribe.getStatus()).set(PAY_COIN_LOG.ILLUSTRATE,nodeSubscribe.getIllustrate()) + .where(PAY_COIN_LOG.ID.eq(nodeSubscribe.getId())).execute(); + } + //订单超过2小时无法确认,直接失败处理 + if(nodeSubscribe.getStatus() == 2 && DateUtils.addMinute(nodeSubscribe.getCreateTime(),30).getTime() < System.currentTimeMillis()){ + dslContext.update(PAY_COIN_LOG).set(PAY_COIN_LOG.STATUS,4).set(PAY_COIN_LOG.ILLUSTRATE,"订单链上确认超过30分钟,直接取消") + .where(PAY_COIN_LOG.ID.eq(nodeSubscribe.getId())).execute(); + } + if(nodeSubscribe.getStatus().equals(4) || nodeSubscribe.getStatus().equals(3)){ + RedisUtil.setEx(nodeSubscribe.getHash(),nodeSubscribe.getStatus().equals(4) ? "0" : nftIds,30); + } + } + + + /** + * 开始对比链上数据是否正确 + * @param nodeSubscribe + * @param transactionDataVo + */ + public void dataVerify(PayCoinLogRecord nodeSubscribe,PayCoinVo transactionDataVo){ + BigDecimal limit = new BigDecimal("1000000000000000000"); + transactionDataVo.setUsdtAmount(transactionDataVo.getUsdtAmount().divide(limit)); + if(transactionDataVo.getStatus() == null || transactionDataVo.getStatus().equals(-1)){ + //链上确认中 + return; + } + if(transactionDataVo.getStatus().equals(0)){ + nodeSubscribe.setIllustrate("链上失败"); + nodeSubscribe.setStatus(4); + return; + } + if(transactionDataVo.getUsdtAmount().compareTo(nodeSubscribe.getPayUsdt()) != 0){ + nodeSubscribe.setIllustrate("支付金额不一致"); + nodeSubscribe.setStatus(4); + return; + } + if(!transactionDataVo.getAddress().equals(nodeSubscribe.getAddress())){ + nodeSubscribe.setIllustrate("支付地址不一致"); + nodeSubscribe.setStatus(4); + } + nodeSubscribe.setIllustrate("成功"); + nodeSubscribe.setStatus(3); + } + + /** + * 获取初始块任务,需要注意控制时间,防止链上限制调用 + */ + public void printLogTask() { + String scannedBlockStr = RedisUtil.get("ALIVE-USDT:scannedBlock"); + if (scannedBlockStr == null || scannedBlockStr.isEmpty()) { + log.error(">>> 无已扫描数据,从20000块前开始"); + BigInteger latestBlock = new BigInteger(RedisUtil.get("ALIVE-USDT:latestBlock")); + scannedBlockStr = latestBlock.subtract(BigInteger.valueOf(20000)).toString(); + RedisUtil.set("ALIVE-USDT:scannedBlock", scannedBlockStr); + } + } + + /** + * 获取最新块 + */ + public void latestBlockTask() throws IOException { + BigInteger latestBlock = this.getBscWsWeb3j().ethBlockNumber().send().getBlockNumber(); + RedisUtil.set("ALIVE-USDT:latestBlock", latestBlock.toString()); + } + + private synchronized List scanBlock(BigInteger startBlock, BigInteger endBlock) { + EthFilter filter = new EthFilter(DefaultBlockParameter.valueOf(startBlock), + DefaultBlockParameter.valueOf(endBlock), + this.getAddresses()); + EthLog send = null; + try { + send = this.getBscWsWeb3j().ethGetLogs(filter).send(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e.getMessage()); + } + if(send.getError() != null && send.getError().getMessage() != null){ + log.info("扫描块失败(检查节点是否被限制) out {} ,{}, {}", startBlock, endBlock, send.getError().getMessage()); + return null; + } + return send.getLogs(); + } + + /** + * 此方法频繁调用会被限制频率 + * 此方法弥补订阅停止或者订阅漏掉区块补救措施 + */ + public void bscScanTask() { + //获取最新块 + try { + this.latestBlockTask(); + this.printLogTask(); + } catch (IOException e) { + } + BigInteger scannedBlock = new BigInteger(RedisUtil.get("ALIVE-USDT:scannedBlock")); + BigInteger latestBlock = new BigInteger(RedisUtil.get("ALIVE-USDT:latestBlock")); + log.info("=====:{},%%%%%%:{}",scannedBlock,latestBlock); + BigInteger offset; + int times = 0; + if(initializeScan){ + //项目重启,扫描前60个区块 + scannedBlock = scannedBlock.subtract(new BigInteger("60")); + initializeScan = false; + } + while (latestBlock.subtract(scannedBlock).longValue() > 2 && times++ < 60) { + if (latestBlock.longValue() - scannedBlock.longValue() > 10000) { + offset = BigInteger.valueOf(500); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 1000) { + offset = BigInteger.valueOf(100); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 100) { + offset = BigInteger.valueOf(50); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 10) { + offset = BigInteger.valueOf(9); + } else if (latestBlock.longValue() - scannedBlock.longValue() > 4) { + offset = BigInteger.valueOf(3); + } else { + offset = BigInteger.valueOf(1); + } + + if (latestBlock.subtract(scannedBlock).longValue() < offset.longValue()) { + break; + } + List resp = this.scanBlock(scannedBlock.add(BigInteger.ONE), scannedBlock.add(offset)); + if(resp == null){ + return; + } + if(resp != null && resp.size() > 0){ + for (EthLog.LogResult logItem : resp) { + this.handleLogEvent((EthLog.LogObject) logItem.get()); + } + } + scannedBlock = scannedBlock.add(offset); + RedisUtil.set("ALIVE-USDT:scannedBlock", scannedBlock.toString()); + } + } + + private synchronized void handleLogEvent(EthLog.LogObject logObject) { + if(RedisUtil.get(logObject.getBlockHash()) != null){ + //重复Hash,不予处理 + return; + } + //重复Hash10分钟过期 + RedisUtil.setEx(logObject.getBlockHash(),"1",60 * 10); + log.info("监听到数据HASH:{},块号:{},交易hash:{}",logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash()); + String data = logObject.getData().substring(2); + List dataList = new ArrayList<>(data.length() / 64); + //获取事件名称 + String even = airTokenService.handle(logObject, dataList); + String date = logObject.getData().substring(2,logObject.getData().length()); + //保存事件 + chainLogService.addChainLog(logObject.getBlockHash(),logObject.getBlockNumber(),logObject.getTransactionHash(),even,date); + if(even != null && even.equals("PaymentSuccess")){ + //我的支付地址 + String address = this.getValue(date,0,true).toLowerCase(); + //我的付款金额 + BigDecimal amount = new BigDecimal(this.getValue(date,1,false)); + //上级地址 + String orderNumber = this.getValue(date,2,false); + PayCoinLogRecord payCoinLogRecord = dslContext.select().from(PAY_COIN_LOG).where(PAY_COIN_LOG.ORDER_NUMBER.eq(orderNumber)).fetchAnyInto(PayCoinLogRecord.class); + if(payCoinLogRecord == null){ + return; + } + payCoinLogRecord.setHash(logObject.getBlockHash()); + PayCoinVo payCoinVo = new PayCoinVo(); + payCoinVo.setAddress(address); + payCoinVo.setUsdtAmount(amount); + payCoinVo.setOrderNumber(orderNumber); + payCoinVo.setStatus(1); + this.addPrivatePlacement(payCoinLogRecord,payCoinVo); + } + } + + + /** + * 查询日志里面加indexed的内容 + * @param topList 日志内容 + * @param code 查询第几个 + * @return + */ + public BigInteger getNmber(List topList,Integer code){ + String ret = topList.get(code); + ret = ret.substring(2,ret.length()); + //16进制转10进制 + return new BigInteger(ret, 16); + } + + /** + * 获取没有加indexed的内容 + * @param date 拆分的参数 + * @param code 取的位数 + * @param address 是否返回地址 + * @return + */ + public String getValue(String date, Integer code, Boolean address){ + int number = 64; + if(code == 0){ + date = date.substring(0,number); + }else{ + code = number * code; + date = date.substring(code,code+number); + } + if(date == null){ + return null; + } + if(address){ + return "0x"+date.substring(24,date.length()); + }else{ + return new BigInteger(date, 16).toString(); + } + } + + public String contractAddress() { + SysConfigPojo config = dslContext.select().from(SYS_CONFIG).where(SYS_CONFIG.CONFIG_KEY.eq("PRIVATE_PLACEMENT")).fetchAnyInto(SysConfigPojo.class); + return config.getValue(); + } + + /** + * 领取空投 + * @return + */ + public Map claimTheAirdrop() { + Map map = new HashMap<>(); + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + CoinConfigRecord configRecord = dslContext.select().from(COIN_CONFIG).where(COIN_CONFIG.AIRDROP_NUMBER.gt(BigDecimal.ZERO)).limit(1).fetchAnyInto(CoinConfigRecord.class); + Assert.isTrue(configRecord != null, "Claim failed"); + Integer count = dslContext.selectCount().from(T_MEMBER_WALLET_LOG).where(T_MEMBER_WALLET_LOG.COIN_ID.eq(configRecord.getId()) + .and(T_MEMBER_WALLET_LOG.MEMBER_ID.eq(memberId)).and(T_MEMBER_WALLET_LOG.OP_TYPE.eq(WalletLogTypeEnum.AIRDROP.getCode()))).fetchAnyInto(Integer.class); + Assert.isTrue(count <= 0, "You ve already claimed it"); + TMemberWalletRecord walletRecord = dslContext.select().from(T_MEMBER_WALLET).where(T_MEMBER_WALLET.COIN_ID.eq(configRecord.getId()) + .and(T_MEMBER_WALLET.MEMBER_ID.eq(memberId))).fetchAnyInto(TMemberWalletRecord.class); + WalletOperation walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.AIRDROP,configRecord.getAirdropNumber(),"空投"); + walletService.operateBalance(walletOperation); + map.put("result","true"); + return map; + } + + public String getAirdropNumber() { + CoinConfigRecord configRecord = dslContext.select().from(COIN_CONFIG).where(COIN_CONFIG.AIRDROP_NUMBER.gt(BigDecimal.ZERO)).limit(1).fetchAnyInto(CoinConfigRecord.class); + if(configRecord == null){ + return "0"; + } + return configRecord.getAirdropNumber().stripTrailingZeros().toPlainString(); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/DingService.java b/alive-api/src/main/java/com/alive/server/service/DingService.java new file mode 100644 index 0000000..e643da6 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/DingService.java @@ -0,0 +1,82 @@ +package com.alive.server.service; + +import com.alive.commons.util.ShaUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Map; + +@Slf4j +@Service +//@Profile({"dev", "test"}) +public class DingService { + + @Autowired + private RestTemplate restTemplate; + private final String token = "92c6649e0ab689bf8963fc6102a49b038832aa16ed85e58627c56355434b02d9"; + + private final String secret = "SEC941a9e16fc8f5eb20ad9786f84c8226d8831bd9b61d69a06ad8d216a67bb2043"; + + //https://oapi.dingtalk.com/robot/send?access_token=a16e52a33b63efd8cebfc718680dd916047b29fddc076b8a27496c573e976abf + public void sendMsg(String mobile, String content) { + + long timestamp = System.currentTimeMillis(); + String sign = null; + try { + byte[] signData = ShaUtil.hmacSha256(timestamp + "\n" + secret, secret); + sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + String sendUrl = String.format("https://oapi.dingtalk.com/robot/send?access_token=%s×tamp=%s&sign=%s", token, timestamp, sign); + String msg = String.format("[测试信息] \n\n发往:%s\n\n内容: %s", mobile, content); + //log.info("测试信息:{}", msg); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity request = new HttpEntity<>(new DingTalkMsgDTO(msg), headers); + Map resp = restTemplate.postForObject(sendUrl, request, Map.class); + System.out.println(resp); + } + + @Data + private static class DingTalkMsgDTO { + + //消息格式,写死文本 + private final String msgtype = "markdown"; + + private Markdown markdown; + + public DingTalkMsgDTO(String mdText) { + markdown = new Markdown(); + markdown.setTitle("测试短信"); + markdown.setText(mdText); + } + +// private Text text; +// public DingTalkMsgDTO(String msg) { +// text = new Text(); +// text.content = msg; +// } + + @Data + public static class Text { + private String content; + } + + @Data + public static class Markdown { + private String title; + private String text; + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/DiscordService.java b/alive-api/src/main/java/com/alive/server/service/DiscordService.java new file mode 100644 index 0000000..274c040 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/DiscordService.java @@ -0,0 +1,331 @@ +package com.alive.server.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alive.server.config.DiscordConfig; +import com.alive.server.dto.DiscordlaborUnionDto; +import com.alive.server.dto.UserDto; +import lombok.extern.slf4j.Slf4j; +import okhttp3.*; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.io.IOException; +import java.net.URLEncoder; +import java.util.*; + +import static com.alive.db.jooq.Tables.T_MEMBER; + + +@Slf4j +@Service +public class DiscordService { + + + @Autowired + private DSLContext dslContext; + + /** + * 生成授权链接 + * @return + */ + public String getAuthorizationUrl(String address) { + Map map = new HashMap<>(); + String url = "https://discord.com/oauth2/authorize?"; + url += "client_id="+ DiscordConfig.CLIENT_ID; + //访问权限 + url += "&response_type=code"; + //回调地址 + url += "&redirect_uri="+DiscordConfig.TOKEN_URL; + //用户地址 + url += "&state="+address; + url += "&scope=identify+guilds+gdm.join+guilds.join+guilds.members.read"; + return url; + } + + /** + * 获取用户token + * @param code + * @param address + */ + public String getTokenByCode(String code,String address){ + try { + String clientId = URLEncoder.encode(DiscordConfig.CLIENT_ID, "UTF-8"); + String clientSecret = URLEncoder.encode(DiscordConfig.CLIENT_SECRET, "UTF-8"); + String credentials = clientId + ":" + clientSecret; + String base64Credentials = Base64.getEncoder().encodeToString(credentials.getBytes()); + + OkHttpClient client = new OkHttpClient(); + String requestBody = null; + String refreshToken = DiscordConfig.getRefreshToken(address); + String accessToken = DiscordConfig.getAccessToken(address); + if(refreshToken != null && accessToken != null){ + return accessToken; + } + if(refreshToken == null && accessToken == null && code == null){ + return null; + } + if(code != null && StringUtils.isBlank(refreshToken)){ + String grantType = "authorization_code"; + // Build request body + requestBody = String.format("grant_type="+grantType+"&code=%s&redirect_uri=%s", + URLEncoder.encode(code, "UTF-8"), + URLEncoder.encode(DiscordConfig.TOKEN_URL, "UTF-8")); + }else{ + String grantType = "refresh_token"; + //刷新令牌需要的参数 + requestBody = String.format("grant_type="+grantType+"&refresh_token=%s&redirect_uri=%s", + URLEncoder.encode(refreshToken, "UTF-8"), + URLEncoder.encode(DiscordConfig.TOKEN_URL, "UTF-8")); + } + // Build request + Request request = new Request.Builder() + .url("https://discord.com/api/oauth2/token") + .post(RequestBody.create(MediaType.parse("application/x-www-form-urlencoded"), requestBody)) + .addHeader("Content-Type", "application/x-www-form-urlencoded") + .addHeader("Authorization", "Basic " + base64Credentials) + .build(); + + // Execute request + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful() || response.code() != 200) { + throw new IOException("Unexpected response code: " + response); + } + JSONObject json = JSON.parseObject(response.body().string()); + accessToken = json.getString("access_token"); + refreshToken = json.getString("refresh_token"); + Integer expiresIn = json.getInteger("expires_in"); + if(StringUtils.isBlank(accessToken) || StringUtils.isBlank(refreshToken)){ + throw new IOException("failed to obtain the token"); + } + //保存用户访问令牌和刷新令牌 + DiscordConfig.addAccessToken(address,accessToken,expiresIn); + DiscordConfig.addRefreshToken(address,refreshToken,60 * 60 * 60); + return accessToken; + } + } catch (Exception e) { + DiscordConfig.deleteAccessToken(address); + DiscordConfig.deleteRefreshToken(address); + e.printStackTrace(); + } + return null; + } + + + /** + * 根据code换取token + * @param code + * @param refreshToken + * @param merchantPojo + * @return + */ + /* public DiscordDto getToken(String code,String refreshToken,MerchantPojo merchantPojo) { + try { + Map formData = new HashMap<>(); + if(!StringUtils.isBlank(code)){ + formData.put("grant_type", "authorization_code"); + formData.put("code", code); + } + if(!StringUtils.isBlank(refreshToken)){ + formData.put("refresh_token", refreshToken); + formData.put("grant_type", "refresh_token"); + } + //重定向配置的URL,一定要和重定向里面的地址保持一致 + formData.put("redirect_uri", merchantPojo.getDcRedirectUrl()); + formData.put("client_id", DiscordConfig.CLIENT_ID); + formData.put("client_secret", DiscordConfig.CLIENT_SECRET); + // 创建URL对象 + DiscordDto discordDto = this.doPostForm("https://discord.com/api/oauth2/token",formData); + return discordDto; + } catch (Exception e) { + throw new RuntimeException(e); + } + }*/ + + /** + * 获取用户的所有服务器 + * @param token + * @return + */ + public List findLaborUnionList(String token) { + try { + // 设置请求URL和Bearer Token + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + HttpGet httpPost = new HttpGet("https://discord.com/api/v9/users/@me/guilds"); + httpPost.setHeader("Content-Type", "application/json;charset=utf8"); + httpPost.setHeader("Authorization", "Bearer " + token); + CloseableHttpResponse response = null; + // 由客户端执行(发送)Post请求 + response = httpClient.execute(httpPost); + // 从响应模型中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + if (response.getStatusLine().getStatusCode() == 200 && responseEntity != null) { + String responseJson = EntityUtils.toString(responseEntity); + JSONArray jsonArray = JSON.parseArray(responseJson); + List jsonArrayToStringList = JSONObject.parseArray(jsonArray.toJSONString(),DiscordlaborUnionDto.class); + return jsonArrayToStringList; + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public Boolean findUserLaborUnion(String token, String guildId) { + try { + // 设置请求URL和Bearer Token + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + HttpGet httpPost = new HttpGet("https://discord.com/api/v9/users/@me/guilds/" + guildId+"/member"); + httpPost.setHeader("Content-Type", "application/json;charset=utf8"); + httpPost.setHeader("Authorization", "Bearer " + token); + CloseableHttpResponse response = null; + // 由客户端执行(发送)Post请求 + response = httpClient.execute(httpPost); + // 从响应模型中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + if (response.getStatusLine().getStatusCode() == 200 && responseEntity != null) { + String responseJson = EntityUtils.toString(responseEntity); + JSONObject jsonArray = JSON.parseObject(responseJson); + if(jsonArray.get("user") != null){ + return true; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + /** + * 查询用户信息 + * @param address + * @return + */ + public UserDto findUser(String address) { + try { + String token = this.getTokenByCode(null,address); + if(token == null){ + return null; + } + // 设置请求URL和Bearer Token + CloseableHttpClient httpClient = HttpClientBuilder.create().build(); + HttpGet httpPost = new HttpGet("https://discord.com/api/v9/users/@me"); + httpPost.setHeader("Content-Type", "application/json;charset=utf8"); + httpPost.setHeader("Authorization", "Bearer " + token); + CloseableHttpResponse response = null; + // 由客户端执行(发送)Post请求 + response = httpClient.execute(httpPost); + // 从响应模型中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + if (response.getStatusLine().getStatusCode() == 200 && responseEntity != null) { + String responseJson = EntityUtils.toString(responseEntity); + JSONObject jsonArray = JSON.parseObject(responseJson); + UserDto userDto = JSON.toJavaObject(jsonArray, UserDto.class); + return userDto; + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 查询用户是否加入Discord + * @param address + * @return + */ + public Boolean joinConfirmation(String address,String guildId) { + //刷新用户token + String accessToken = this.getTokenByCode(null,address); + if(accessToken == null){ + return false; + } + //查询用户工会 + return this.findUserLaborUnion(accessToken,guildId); + } + + public void bindUser(String id) { + Integer num = dslContext.selectCount().from(T_MEMBER).where(T_MEMBER.DISCORD_ID.eq(id)).fetchAnyInto(Integer.class); + Assert.isTrue(num == 0,"The account has been linked Discord"); + } + + /*public String getDiscordByCodeUrl(DcAttentionReq dcAttentionReq) { + String token = this.getRefreshToken(dcAttentionReq.getAddress()); + String discordUserIdKey = "discord_user_token"+dcAttentionReq.getAddress(); + //查询用户个人信息 + String discordUserId = RedisUtil.get(discordUserIdKey); + if(discordUserId == null){ + discordUserId = this.findUser(token).getId(); + RedisUtil.setEx(discordUserIdKey,discordUserId,60 * 100); + } + try { + //先把原订单取消掉 + dslContext.update(TASK_LOG).set(TASK_LOG.TASK_TYPE,4).where(TASK_LOG.ADDRESS.eq(dcAttentionReq.getAddress()) + .and(TASK_LOG.STATUS.eq(3)).and(TASK_LOG.TASK_TYPE.eq(2))).execute(); + TaskLogRecord log = dslContext.newRecord(TASK_LOG); + log.setAddress(dcAttentionReq.getAddress()); + log.setMerchantId(1); + log.setTaskOn("001"); + log.setType(dcAttentionReq.getCodeNo()); + log.setStatus(3); + log.setUserId(discordUserId); + log.setTaskType(2); + log.store(); + + return DiscordConfig.INVITE_URL; + } catch (Exception e) { + throw new RuntimeException(e); + } + }*/ + + + + + /* public TgUserReq findChannelMember(DcAttentionReq dcAttentionReq) { + TgUserReq tgUserReq = new TgUserReq(); + tgUserReq.setStatus(0); + Assert.isTrue(!StringUtils.isBlank(dcAttentionReq.getAddress()) && + !StringUtils.isBlank(dcAttentionReq.getMerchantOn()) && dcAttentionReq.getCodeNo() != null, "parameter not null"); + dcAttentionReq.setAddress(dcAttentionReq.getAddress().toLowerCase()); + if(dcAttentionReq.getDay() != null && dcAttentionReq.getDay() == 1){ + String value = RedisUtil.get("roost_gpask_discord"+dcAttentionReq.getAddress()); + if(value != null){ + tgUserReq.setStatus(1); + } + }else{ + TaskLogRecord taskLogRecord = merchantService.getTaskLog(dcAttentionReq.getAddress(),dcAttentionReq.getCodeNo(),3,3); + Assert.notNull(taskLogRecord,"tsak is null"); + tgUserReq.setStatus(taskLogRecord.getTaskType().equals(3) ? 1 : 0); + } + return tgUserReq; + } + + public String getStartTgUrl(DcFaucetReq dcFaucetReq) { + MerchantPojo merchantPojo = merchantService.getMerchant(dcFaucetReq.getCodeNo(),dcFaucetReq.getMerchantOn()); + MerchantConfigPojo merchantConfigPojo = merchantService.getMerchantConfig(merchantPojo.getId()); + dslContext.update(TASK_LOG).set(TASK_LOG.TASK_TYPE,4).where(TASK_LOG.ADDRESS.eq(dcFaucetReq.getAddress()) + .and(TASK_LOG.STATUS.eq(3)).and(TASK_LOG.TASK_TYPE.in(1,2)).and(TASK_LOG.MERCHANT_ID.eq(merchantPojo.getId()))).execute(); + TaskLogRecord log = dslContext.newRecord(TASK_LOG); + log.setMerchantId(merchantPojo.getId()); + log.setAddress(dcFaucetReq.getAddress()); + log.setTaskOn("00X"); + log.setType(dcFaucetReq.getCodeNo()); + log.setTaskType(1); + log.setStatus(3); + log.setUserId("0"); + log.store(); + return merchantConfigPojo.getDcInviteUrl(); + }*/ + + +} diff --git a/alive-api/src/main/java/com/alive/server/service/MemberService.java b/alive-api/src/main/java/com/alive/server/service/MemberService.java new file mode 100644 index 0000000..5ead1a8 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/MemberService.java @@ -0,0 +1,86 @@ +package com.alive.server.service; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.util.Md5Util; +import com.alive.commons.util.RequestUtil; +import com.alive.db.entity.Vo.InvitationCodeVo; +import com.alive.db.jooq.tables.records.TMemberRecord; +import com.alive.server.dto.TwitterUserDto; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.math.NumberUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.*; + +import static com.alive.db.jooq.Tables.T_MEMBER; + +@Slf4j +@Service +public class MemberService extends BaseComponent { + + public List splitAllPid(String allPid) { + if (allPid == null || allPid.isEmpty()) { + return Collections.emptyList(); + } + String[] arr = allPid.split(","); + List res = new ArrayList<>(arr.length); + for (String str : arr) { + if (NumberUtils.isNumber(str)) { + res.add(Integer.parseInt(str)); + } + } + Collections.reverse(res); + return res; + } + + public Integer countTwitterUser(String address) { + return dslContext.selectCount().from(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(address).and(T_MEMBER.TWITTER_ID.isNotNull())).fetchAnyInto(Integer.class); + } + + public Integer countDiscordUser(String address) { + return dslContext.selectCount().from(T_MEMBER).where(T_MEMBER.ACCOUNT.eq(address).and(T_MEMBER.DISCORD_ID.isNotNull())).fetchAnyInto(Integer.class); + } + + public void renewalUserDiscord(String address,String discordId) { + dslContext.update(T_MEMBER).set(T_MEMBER.DISCORD_ID,discordId).where(T_MEMBER.ACCOUNT.eq(address)).execute(); + } + + public void renewalUserTwitter(TwitterUserDto dto, String address) { + dslContext.update(T_MEMBER).set(T_MEMBER.TWITTER_TYPE,1).set(T_MEMBER.TWITTER_USER_NAME,dto.getUsername()).set(T_MEMBER.TWITTER_ID,dto.getId()) + .set(T_MEMBER.TWITTER_NAME,dto.getName()).set(T_MEMBER.TWITTER_IMG,dto.getImg()).where(T_MEMBER.ACCOUNT.eq(address)).execute(); + } + + public TMemberRecord fetchOne(int memberId) { + return dslContext.fetchOne(T_MEMBER, T_MEMBER.ID.eq(memberId)); + } + + public List findTMemberRecordList(int memberId) { + return dslContext.select().from(T_MEMBER).where(T_MEMBER.ALL_PID.like(","+memberId+",")).fetchInto(TMemberRecord.class); + } + + public Integer findTMemberRecordCount(int memberId) { + return dslContext.selectCount().from(T_MEMBER).where(T_MEMBER.ALL_PID.likeRegex(","+memberId+",")).fetchAnyInto(Integer.class); + } + + public TMemberRecord fetchOneByUid(String uid) { + return dslContext.selectFrom(T_MEMBER).where(T_MEMBER.UID.eq(uid)).fetchAny(); + } + + public void checkPassword(int memberId, String password) { + TMemberRecord memberRecord = dslContext.fetchOne(T_MEMBER, T_MEMBER.ID.eq(memberId)); + Assert.notNull(memberRecord, "account does not exist"); + Assert.isTrue(Md5Util.encryptPassword(password).equals(memberRecord.getPasswordLogin()), "wrong password"); + } +/* public void checkPayPassword(int memberId, String password) { + TMemberRecord memberRecord = dslContext.fetchOne(T_MEMBER, T_MEMBER.ID.eq(memberId)); + Assert.notNull(memberRecord, "账号不存在"); + Assert.isTrue(Md5Util.encryptPassword(password).equals(memberRecord.getPasswordPay()), "支付密码错误"); + }*/ + + public InvitationCodeVo invitationCode() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + TMemberRecord memberRecord = dslContext.fetchOne(T_MEMBER, T_MEMBER.ID.eq(memberId)); + return memberRecord != null ? new InvitationCodeVo().setInvitationCode(memberRecord.getShareCode()) : new InvitationCodeVo(); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/MyTelegramBot.java b/alive-api/src/main/java/com/alive/server/service/MyTelegramBot.java new file mode 100644 index 0000000..e678c1f --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/MyTelegramBot.java @@ -0,0 +1,48 @@ +package com.alive.server.service; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.telegram.telegrambots.bots.TelegramWebhookBot; +import org.telegram.telegrambots.meta.api.methods.BotApiMethod; +import org.telegram.telegrambots.meta.api.objects.Update; +import org.telegram.telegrambots.meta.api.objects.User; +import org.telegram.telegrambots.meta.TelegramBotsApi; +import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; +import org.telegram.telegrambots.meta.api.objects.Chat; + +@Slf4j +@Service +public class MyTelegramBot extends TelegramWebhookBot { + + private String token ="6811525345:AAFMiaC3Q_h2kn2uXQG7m2YuaIOT9vWG0G0"; + private String username ="ROOS_Test_Bot"; + + @Override + public BotApiMethod onWebhookUpdateReceived(Update update) { + // 处理 ChatMemberUpdated 事件 + /*if (update.hasMessage() && update.getMessage().getChatMemberUpdated() != null) { + ChatMemberUpdated chatMemberUpdated = update.getMessage().getChatMemberUpdated(); + processChatMemberUpdated(chatMemberUpdated); + }*/ + System.out.printf("111223"); + return null; + } + + + + @Override + public String getBotUsername() { + return username; + } + + @Override + public String getBotToken() { + return token; + } + + @Override + public String getBotPath() { + return "http://gqydas.natappfree.cc/telegram/test"; + } + +} diff --git a/alive-api/src/main/java/com/alive/server/service/NodeBuyLogService.java b/alive-api/src/main/java/com/alive/server/service/NodeBuyLogService.java new file mode 100644 index 0000000..03eaaf0 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/NodeBuyLogService.java @@ -0,0 +1,112 @@ +package com.alive.server.service; + +import com.alive.commons.util.RequestUtil; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.WordNodeVo; +import com.alive.db.mapper.NodeBuyLogMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 节点认购记录Service业务层处理 + * + * @author HayDen + * @date 2024-01-09 + */ +@Service +public class NodeBuyLogService +{ + @Autowired + private NodeBuyLogMapper nodeSubscribeMapper; + + /** + * 查询节点认购记录 + * + * @param id 节点认购记录ID + * @return 节点认购记录 + */ + public NodeBuyLog selectNodeSubscribeById(Integer id) + { + return nodeSubscribeMapper.selectNodeSubscribeById(id); + } + + public Integer countBuyLogByUserId(NodeBuyLog nodeSubscribe) + { + return nodeSubscribeMapper.countBuyLogByUserId(nodeSubscribe); + } + + /** + * 查询节点认购记录列表 + * + * @param nodeSubscribe 节点认购记录 + * @return 节点认购记录 + */ + public List selectNodeSubscribeList(NodeBuyLog nodeSubscribe) + { + List nodeSubscribeList = nodeSubscribeMapper.selectNodeSubscribeList(nodeSubscribe); + return nodeSubscribeList; + } + + public NodeBuyLog findNodeSubscribeByOrderNumber(String orderNumber) + { + return nodeSubscribeMapper.findNodeSubscribeByOrderNumber(orderNumber); + } + + /** + * 查询节点认购记录对象 + * + * @param nodeSubscribe 节点认购记录 + * @return 节点认购记录 + */ + public NodeBuyLog findNodeSubscribe(NodeBuyLog nodeSubscribe) + { + nodeSubscribe = nodeSubscribeMapper.findNodeSubscribe(nodeSubscribe); + return nodeSubscribe; + } + + public WordNodeVo findWordNodeVo() + { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + WordNodeVo wordNodeVo= nodeSubscribeMapper.findWordNodeVo(memberId); + if(wordNodeVo == null || StringUtils.isBlank(wordNodeVo.getNodeName())){ + wordNodeVo = new WordNodeVo(); + Integer count = this.countBuyLogByUserId(new NodeBuyLog().setUserId(memberId).setStatus(2)); + if(count != null && count > 0){ + wordNodeVo.setStatus(2); + }else{ + wordNodeVo.setStatus(3); + } + }else{ + wordNodeVo.setStatus(1); + } + return wordNodeVo; + } + + /** + * 修改或者添加节点认购记录 + * + * @param nodeSubscribe 节点认购记录 + * @return 结果 + */ + public int updateOrAddNodeSubscribe(NodeBuyLog nodeSubscribe) { + if (nodeSubscribe.getId() != null){ + return nodeSubscribeMapper.updateNodeSubscribe(nodeSubscribe); + }else{ + return nodeSubscribeMapper.insertNodeSubscribe(nodeSubscribe); + } + } + + /** + * 删除节点认购记录对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteNodeSubscribeByIds(String ids) + { + return 0; + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/NodeNftConfigService.java b/alive-api/src/main/java/com/alive/server/service/NodeNftConfigService.java new file mode 100644 index 0000000..8b97805 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/NodeNftConfigService.java @@ -0,0 +1,172 @@ +package com.alive.server.service; + +import com.alive.commons.enums.WalletLogTypeEnum; +import com.alive.commons.util.CoinUtil; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.NodeNftConfig; +import com.alive.db.jooq.tables.records.TMemberRecord; +import com.alive.db.jooq.tables.records.TMemberWalletRecord; +import com.alive.db.mapper.NodeNftConfigMapper; +import com.alive.server.dto.WalletOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * NFT碎片配置Service业务层处理 + * + * @author HayDen + * @date 2024-01-09 + */ +@Service +public class NodeNftConfigService +{ + @Autowired + private NodeNftConfigMapper nodeNftConfigMapper; + + @Autowired + private WalletService walletService; + + @Autowired + private MemberService memberService; + + /** + * 查询NFT碎片配置 + * + * @param id NFT碎片配置ID + * @return NFT碎片配置 + */ + public NodeNftConfig selectNodeNftConfigById(Integer id) + { + return nodeNftConfigMapper.selectNodeNftConfigById(id); + } + + /** + * 查询NFT碎片配置列表 + * + * @param nodeNftConfig NFT碎片配置 + * @return NFT碎片配置 + */ + public List selectNodeNftConfigList(NodeNftConfig nodeNftConfig) + { + List nodeNftConfigList = nodeNftConfigMapper.selectNodeNftConfigList(nodeNftConfig); + return nodeNftConfigList; + } + + /** + * 查询NFT碎片配置对象 + * + * @param nodeNftConfig NFT碎片配置 + * @return NFT碎片配置 + */ + public NodeNftConfig findNodeNftConfig(NodeNftConfig nodeNftConfig) + { + nodeNftConfig = nodeNftConfigMapper.findNodeNftConfig(nodeNftConfig); + return nodeNftConfig; + } + + /** + * 修改或者添加NFT碎片配置 + * + * @param nodeNftConfig NFT碎片配置 + * @return 结果 + */ + public int updateOrAddNodeNftConfig(NodeNftConfig nodeNftConfig) { + if (nodeNftConfig.getId() != null){ + return nodeNftConfigMapper.updateNodeNftConfig(nodeNftConfig); + }else{ + return nodeNftConfigMapper.insertNodeNftConfig(nodeNftConfig); + } + } + + /** + * 删除NFT碎片配置对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteNodeNftConfigByIds(String ids) + { + return nodeNftConfigMapper.deleteNodeNftConfigByIds(null); + } + + /** + * 注册赠送奖励、NTF碎片以及贡献值 + */ + public void reward(NodeBuyLog nodeSubscribe) { + TMemberWalletRecord walletRecord= null; + WalletOperation walletOperation = null; + //先给用户自己发放奖励 + { + if(nodeSubscribe.getRbitAmount().compareTo(BigDecimal.ZERO) > 0){ + //购买盒子获取Rbit奖励数量 + walletRecord= walletService.getWallet(nodeSubscribe.getUserId(), CoinUtil.getCoinMap().get("RBIT")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.RBIT_IS_COMPLIMENTARY_ON_ORDERS,nodeSubscribe.getRbitAmount(),"购买盒子赠送"); + walletService.operateBalance(walletOperation); + } + if(nodeSubscribe.getNftAmount().compareTo(BigDecimal.ZERO) > 0){ + walletRecord= walletService.getWallet(nodeSubscribe.getUserId(), CoinUtil.getCoinMap().get("NFTCHIP")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.ORDER_FREE_NFT,nodeSubscribe.getNftAmount(),"购买盒子赠送"); + walletService.operateBalance(walletOperation); + } + } + + //查询我的用户信息 + TMemberRecord tMemberRecord = memberService.fetchOne(nodeSubscribe.getUserId()); + if(tMemberRecord.getReferId().equals(0)){ + //用户没有绑定上级,直接返回不计算奖励 + return; + } + + //上级返佣 + if(nodeSubscribe.getRebate().compareTo(BigDecimal.ZERO) > 0){ + //返佣金额 + walletRecord= walletService.getWallet(tMemberRecord.getReferId(), CoinUtil.getCoinMap().get("USDT")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.SUBCOMMISSION,nodeSubscribe.getRebate(),"认购下级返佣"); + walletService.operateBalance(walletOperation); + + //链上支付了,扣回去,但是需要流水统计数据 + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.REBATE_TO_ACCOUNT,nodeSubscribe.getRebate().negate(),"返佣到账"); + walletService.operateBalance(walletOperation); + } + + { + if(nodeSubscribe.getRbitOne().compareTo(BigDecimal.ZERO) > 0){ + //1代增加Rbit奖励 + nodeSubscribe.setRecommendId(tMemberRecord.getReferId()); + walletRecord= walletService.getWallet(nodeSubscribe.getRecommendId(), CoinUtil.getCoinMap().get("RBIT")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.ONE_RBIT_REWARD,nodeSubscribe.getRbitOne(),"1代Rbit奖励"); + walletService.operateBalance(walletOperation); + } + if(nodeSubscribe.getNftOne().compareTo(BigDecimal.ZERO) > 0){ + //1代NFT碎片奖励 + walletRecord= walletService.getWallet(nodeSubscribe.getRecommendId(), CoinUtil.getCoinMap().get("NFTCHIP")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.ONE_NFT_REWARD,nodeSubscribe.getNftOne(),"1代NFT配件奖励"); + walletService.operateBalance(walletOperation); + } + } + + tMemberRecord = memberService.fetchOne(tMemberRecord.getReferId()); + if(tMemberRecord.getReferId().equals(0)){ + //用户没有2级上级,直接返回不计算奖励 + return; + } + { + if(nodeSubscribe.getRbitTwo().compareTo(BigDecimal.ZERO) > 0){ + nodeSubscribe.setIndirectUserId(tMemberRecord.getReferId()); + walletRecord= walletService.getWallet(nodeSubscribe.getIndirectUserId(), CoinUtil.getCoinMap().get("RBIT")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.TWO_RBIT_REWARD,nodeSubscribe.getRbitTwo(),"2代Rbit奖励"); + walletService.operateBalance(walletOperation); + } + if(nodeSubscribe.getNftTwo().compareTo(BigDecimal.ZERO) > 0){ + //2代NFT碎片奖励 + walletRecord= walletService.getWallet(nodeSubscribe.getIndirectUserId(), CoinUtil.getCoinMap().get("NFTCHIP")); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.TWO_NFT_REWARD,nodeSubscribe.getNftTwo(),"2代NFT配件奖励"); + walletService.operateBalance(walletOperation); + } + } + } + +} diff --git a/alive-api/src/main/java/com/alive/server/service/NodePriceConfigService.java b/alive-api/src/main/java/com/alive/server/service/NodePriceConfigService.java new file mode 100644 index 0000000..9a16431 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/NodePriceConfigService.java @@ -0,0 +1,87 @@ +package com.alive.server.service; + +import com.alive.db.entity.NodePriceConfig; +import com.alive.db.mapper.NodePriceConfigMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 节点价格区间配置Service业务层处理 + * + * @author HayDen + * @date 2024-01-09 + */ +@Service +public class NodePriceConfigService +{ + @Autowired + private NodePriceConfigMapper nodePriceConfigMapper; + + /** + * 查询节点价格区间配置 + * + * @param id 节点价格区间配置ID + * @return 节点价格区间配置 + */ + public NodePriceConfig selectNodePriceConfigById(Integer id) + { + return nodePriceConfigMapper.selectNodePriceConfigById(id); + } + + /** + * 查询节点价格区间配置列表 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 节点价格区间配置 + */ + public List selectNodePriceConfigList(NodePriceConfig nodePriceConfig) + { + List nodePriceConfigList = nodePriceConfigMapper.selectNodePriceConfigList(nodePriceConfig); + return nodePriceConfigList; + } + + /** + * 查询节点价格区间配置对象 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 节点价格区间配置 + */ + public NodePriceConfig findNodePriceConfig(NodePriceConfig nodePriceConfig) + { + nodePriceConfig = nodePriceConfigMapper.findNodePriceConfig(nodePriceConfig); + return nodePriceConfig; + } + + /** + * 修改或者添加节点价格区间配置 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 结果 + */ + public int updateOrAddNodePriceConfig(NodePriceConfig nodePriceConfig) { + if (nodePriceConfig.getId() != null){ + return nodePriceConfigMapper.updateNodePriceConfig(nodePriceConfig); + }else{ + return nodePriceConfigMapper.insertNodePriceConfig(nodePriceConfig); + } + } + + /** + * 删除节点价格区间配置对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteNodePriceConfigByIds(String ids) + { + return 0; + } + + public BigDecimal getConfigPrice(Long nodeSettingId, Integer number) + { + return nodePriceConfigMapper.getConfigPrice(nodeSettingId,number); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/NodeSettingService.java b/alive-api/src/main/java/com/alive/server/service/NodeSettingService.java new file mode 100644 index 0000000..7067141 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/NodeSettingService.java @@ -0,0 +1,273 @@ +package com.alive.server.service; + +import com.alive.commons.util.NumberUtil; +import com.alive.commons.util.RequestUtil; +import com.alive.server.api.account.PayNodeReq; +import com.alive.server.api.account.PayNodeSmsReq; +import com.alive.commons.config.BaseComponent; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.NodeSetting; +import com.alive.db.entity.Vo.InviteVo; +import com.alive.db.entity.Vo.UserInviteVo; +import com.alive.db.entity.Vo.UserTeamVo; +import com.alive.db.entity.Vo.WordNodeVo; +import com.alive.db.jooq.tables.pojos.SysConfigPojo; +import com.alive.db.jooq.tables.records.NodeAwardSettingRecord; +import com.alive.db.mapper.NodeBuyLogMapper; +import com.alive.db.mapper.NodeSettingMapper; +import com.alive.server.web3.Web3jServer; +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.List; +import java.util.Random; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import static com.alive.db.jooq.Tables.*; + +/** + * 节点设置Service业务层处理 + * + * @author HayDen + * @date 2024-01-09 + */ +@Slf4j +@Service +public class NodeSettingService extends BaseComponent { + @Resource + private NodeSettingMapper nodeSettingMapper; + + @Resource + private NodeBuyLogMapper nodeSubscribeMapper; + + @Autowired + private DSLContext dslContext; + + @Resource + private MemberService tMemberService; + + @Autowired + private Web3jServer web3jServer; + + + public boolean buyNode() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + Integer code = dslContext.selectCount().from(NODE_BUY_LOG).where(NODE_BUY_LOG.USER_ID.eq(memberId).and(NODE_BUY_LOG.STATUS.eq(3))).fetchAnyInto(Integer.class); + return code != null && code > 0; + } + + public UserInviteVo findUserInviteVo() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + UserInviteVo vo = nodeSettingMapper.findUserInviteVo(memberId); + return vo; + } + + + /** + * 下单购买节点 + * + * @param nodeSetting + * @param req + */ + public NodeBuyLog payNode(NodeSetting nodeSetting, PayNodeReq req) { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + Assert.isTrue(nodeSetting.getStatus().equals(1), "Not available or sold out"); + Assert.isTrue(nodeSetting.getNodeTotal() > (nodeSetting.getPurchasedCount() + req.getNumber()), "Insufficient nodes"); + //计算库存 + int count = nodeSubscribeMapper.sumBuyCount(memberId); + Assert.isTrue((count + req.getNumber()) <= nodeSetting.getPurchaseLimit(), "Only one ROOSBOX can be purchased"); + SysConfigPojo config = dslContext.select().from(SYS_CONFIG).where(SYS_CONFIG.CONFIG_KEY.eq("USDT_COLLECTION_ADDRESS")).fetchAnyInto(SysConfigPojo.class); + NodeAwardSettingRecord pojo = dslContext.selectFrom(NODE_AWARD_SETTING).where(NODE_AWARD_SETTING.NODE_SETTING_ID.eq(nodeSetting.getId())).fetchAny(); + + UserTeamVo userTeamVo = nodeSubscribeMapper.findUserAddressById(memberId); + userTeamVo = userTeamVo == null ? new UserTeamVo() : userTeamVo; + NodeBuyLog buyLog1 = new NodeBuyLog(); + Lock lock = new ReentrantLock(); + lock.lock(); + try { + //查询奖励配置 + if (pojo != null) { + //上级返佣 + buyLog1.setRebate(req.getTatolAmount().multiply(pojo.getRebate())); + buyLog1.setRbitAmount(new BigDecimal(req.getNumber()).multiply(pojo.getRbitAmount())); + buyLog1.setRbitOne(buyLog1.getRbitAmount().multiply(pojo.getRbitOne())); + buyLog1.setRbitTwo(buyLog1.getRbitAmount().multiply(pojo.getRebateTwo())); + buyLog1.setNftAmount(new BigDecimal(req.getNumber()).multiply(pojo.getNftAmount())); + buyLog1.setNftOne(buyLog1.getNftAmount().multiply(pojo.getNftOne())); + buyLog1.setNftTwo(buyLog1.getNftAmount().multiply(pojo.getNftTwo())); + } + buyLog1.setRecommendId(userTeamVo.getId()); + buyLog1.setBuyCount(req.getNumber()); + buyLog1.setPayCoin(nodeSetting.getBuyCoinName()); + buyLog1.setBuyAmount(req.getTatolAmount()); + buyLog1.setNodeSettingId(nodeSetting.getId()); + buyLog1.setStatus(1); + buyLog1.setWalletAddress(RequestUtil.getAddress()); + buyLog1.setUserId(memberId); + buyLog1.setOrderNumber(NumberUtil.getUUIDBy16()); + buyLog1.setOutAddress(config.getValue()); + nodeSubscribeMapper.insertNodeSubscribe(buyLog1); + } catch (Exception e) { + log.error("下单出现错误,错误码:{}", e); + e.getMessage(); + throw new RuntimeException(e); + } finally { + lock.unlock(); + } + config = dslContext.select().from(SYS_CONFIG).where(SYS_CONFIG.CONFIG_KEY.eq("USDT_WEI")).fetchAnyInto(SysConfigPojo.class); + buyLog1.setBuyAmount(new BigDecimal(config.getValue()).multiply(buyLog1.getBuyAmount())); + buyLog1.setRebate(new BigDecimal(config.getValue()).multiply(buyLog1.getRebate())); + String address = userTeamVo.getAccount(); + if (address == null || pojo.getRebate().compareTo(BigDecimal.ZERO) == 0 || !address.substring(0, 2).equals("0x") || address.length() < 30) { + buyLog1.setAddress(BigInteger.ZERO.toString()); + buyLog1.setRebateRatio(new BigInteger("100")); + buyLog1.setNum(100); + } else { + + BigDecimal rebate = pojo.getRebate().multiply(new BigDecimal(config.getValue())); + rebate = rebate.add(new BigDecimal(300)); + Integer num = getRandom4(); + rebate = rebate.multiply(new BigDecimal(num)); + buyLog1.setRebateRatio(new BigInteger(rebate.stripTrailingZeros().toPlainString())); + buyLog1.setNum((num * 3) + 500 - num); + buyLog1.setAddress(Web3jServer.addressToUint160(address).add(new BigInteger("300")).subtract(new BigInteger(num.toString())).toString()); + } + return buyLog1; + } + + public static Integer getRandom4() { + Random random = new Random(); + // 生成0到9之间的随机数(包括0但不包括10) + int randomNum = random.nextInt(10); + if (randomNum == 0) { + return getRandom4(); + } + return randomNum; + } + + + /** + * 查询用户邀请列表 + */ + public List findInviteVoList() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + List inviteVos = nodeSubscribeMapper.findInviteVoList(memberId); + for (InviteVo vo : inviteVos) { + vo.setStatus(vo.getStatus() == null ? 0 : 1); + } + return inviteVos; + } + + + public Boolean payNodeSms(PayNodeSmsReq req) { + NodeBuyLog nodeSubscribe = nodeSubscribeMapper.findNodeSubscribe(new NodeBuyLog().setOrderNumber(req.getOrderNumber()).setStatus(1)); + Assert.isTrue(nodeSubscribe != null && nodeSubscribe.getStatus().equals(1), "Order error"); + if (req.getStatus().equals(2)) { + nodeSubscribe.setStatus(4); + nodeSubscribeMapper.updateNodeSubscribe(nodeSubscribe); + return true; + } + NodeBuyLog log = nodeSubscribeMapper.findNodeSubscribe(new NodeBuyLog().setHash(req.getHash())); + Assert.isTrue(log == null, "Repetition hash"); + nodeSubscribe.setStatus(2); + nodeSubscribe.setHash(req.getHash()); + if (nodeSubscribe.getStatus() == 2) { + //加库存 + // nodeSettingMapper.addInventory(nodeSubscribe.getBuyCount(),nodeSubscribe.getNodeId()); + } + nodeSubscribeMapper.updateNodeSubscribe(nodeSubscribe); + return true; + } + + + /** + * 查询节点设置 + * + * @param id 节点设置ID + * @return 节点设置 + */ + public NodeSetting selectNodeSettingById(Integer id) { + return nodeSettingMapper.selectNodeSettingById(id); + } + + /** + * 查询节点设置列表 + * + * @param nodeSetting 节点设置 + * @return 节点设置 + */ + public List selectNodeSettingList(NodeSetting nodeSetting) { + List nodeSettingList = nodeSettingMapper.selectNodeSettingList(nodeSetting); + BigDecimal mul = new BigDecimal("100"); + for (NodeSetting nodeSetting1 : nodeSettingList) { + nodeSetting1.setRebateRatio(nodeSetting1.getRebateRatio().multiply(mul)); + nodeSetting1.setRbitOne(nodeSetting1.getRbitOne().multiply(mul)); + nodeSetting1.setNftOne(nodeSetting1.getNftOne().multiply(mul)); + nodeSetting1.setNftTwo(nodeSetting1.getNftTwo().multiply(mul)); + nodeSetting1.setRebateTwo(nodeSetting1.getRebateTwo().multiply(mul)); + } + return nodeSettingList; + } + + /** + * 查询节点设置对象 + * + * @param nodeSetting 节点设置 + * @return 节点设置 + */ + public NodeSetting findNodeSetting(NodeSetting nodeSetting) { + nodeSetting = nodeSettingMapper.findNodeSetting(nodeSetting); + return nodeSetting; + } + + + /** + * 修改或者添加节点设置 + * + * @param nodeSetting 节点设置 + * @return 结果 + */ + public int updateOrAddNodeSetting(NodeSetting nodeSetting) { + if (nodeSetting.getId() != null) { + return nodeSettingMapper.updateNodeSetting(nodeSetting); + } else { + return nodeSettingMapper.insertNodeSetting(nodeSetting); + } + } + + + public List getWOrdNodePro() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + /*web3jServer.getWeb3j().ethGetTransactionReceipt(null); + + // ERC721 合约地址和查询的地址 + String contractAddress = web3jServer.bftContract; + String ownerAddress = "0x1167398aa2b694edb1c24874d4c7d70340e81606"; + + // 加载 ERC721 合约 ABI + // 替换 YOUR_CONTRACT_ADDRESS 和 YOUR_CONTRACT_ABI + String contractAddress = "YOUR_CONTRACT_ADDRESS"; + String contractABI = "YOUR_CONTRACT_ABI"; + + // 创建 ERC721 合约实例 + ERC721 contract = ERC721.load(contractAddress, web3j, credentials, Contract.GAS_PRICE, Contract.GAS_LIMIT); + + // 获取地址的 NFT 数量 + String ownerAddress = "ADDRESS_TO_CHECK"; // 替换为您要查询的地址 + BigInteger nftCount = contract.balanceOf(ownerAddress).send(); + System.out.println("Address " + ownerAddress + " has " + nftCount + " NFTs.");*/ + return nodeSettingMapper.getWOrdNodePro(memberId); + } + + public String contractAddress() { + SysConfigPojo config = dslContext.select().from(SYS_CONFIG).where(SYS_CONFIG.CONFIG_KEY.eq("CONTRACT_ADDRESS")).fetchAnyInto(SysConfigPojo.class); + return config.getValue(); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/OnChainTransfersService.java b/alive-api/src/main/java/com/alive/server/service/OnChainTransfersService.java new file mode 100644 index 0000000..ca642f2 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/OnChainTransfersService.java @@ -0,0 +1,63 @@ +package com.alive.server.service; + +import com.alive.server.dto.TransferDto; +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +import static com.alive.db.jooq.Tables.ACTIVITY_LOG; +import static com.alive.db.jooq.Tables.T_MEMBER; + +/** + * 链上转账API + */ +@Slf4j +@Service +public class OnChainTransfersService { + + + @Autowired + private DSLContext dslContext; + + @Autowired + private TokenTransferServer tokenTransferServer; + + /** + * 执行链上转账,换回转账HASH + * @return + */ + public void transfer() { + List activityLogRecords = dslContext.select(ACTIVITY_LOG.ID,ACTIVITY_LOG.SUPERIOR_ADDRESS,ACTIVITY_LOG.ADDRESS,ACTIVITY_LOG.AMOUNT,ACTIVITY_LOG.SUPERIOR_AMOUNT,T_MEMBER.REFER_ID) + .from(ACTIVITY_LOG).leftJoin(T_MEMBER).on(ACTIVITY_LOG.ADDRESS.eq(T_MEMBER.ACCOUNT)) + .where(ACTIVITY_LOG.TYPE.eq(2) + .and(ACTIVITY_LOG.TRANSFER_TYPE.eq(0))).fetchInto(TransferDto.class); + for (TransferDto logRecord : activityLogRecords){ + //用户转账的地址 + String address = logRecord.getAddress(); + BigDecimal amount = logRecord.getAmount(); + // 将以太币数量转换为 Wei + BigDecimal ethInWei = amount.multiply(BigDecimal.TEN.pow(18)); + //执行用户链上转账 + String hash = tokenTransferServer.transferTo(ethInWei,address,0); + if(hash == null){ + continue; + } + //上级转账金额 + if(logRecord.getSuperiorAddress() != null && logRecord.getSuperiorAmount().compareTo(BigDecimal.ZERO) > 0){ + // 将以太币数量转换为 Wei + ethInWei = logRecord.getSuperiorAmount().multiply(BigDecimal.TEN.pow(18)); + //执行用户上级链上转账 + String superiorHash = tokenTransferServer.transferTo(ethInWei,logRecord.getSuperiorAddress(),0); + if(superiorHash != null){ + hash = hash +" | " + superiorHash; + } + } + dslContext.update(ACTIVITY_LOG).set(ACTIVITY_LOG.TRANSFER_TYPE,1).set(ACTIVITY_LOG.HASHS,hash).where(ACTIVITY_LOG.ID.eq(logRecord.getId())).execute(); + } + } + +} diff --git a/alive-api/src/main/java/com/alive/server/service/PersonalCenterService.java b/alive-api/src/main/java/com/alive/server/service/PersonalCenterService.java new file mode 100644 index 0000000..a73264d --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/PersonalCenterService.java @@ -0,0 +1,167 @@ +package com.alive.server.service; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.enums.WalletLogTypeEnum; +import com.alive.commons.model.BasePageReq; +import com.alive.commons.util.CoinUtil; +import com.alive.commons.util.RequestUtil; +import com.alive.db.entity.Vo.*; +import com.alive.db.jooq.tables.records.NodeTaskLogRecord; +import com.alive.db.jooq.tables.records.NodeTaskRecord; +import com.alive.db.jooq.tables.records.TMemberRecord; +import com.alive.db.jooq.tables.records.TMemberWalletRecord; +import com.alive.db.mapper.PersonalCenterMapper; +import com.alive.server.api.account.TeskReq; +import com.alive.server.dto.WalletOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.math.BigDecimal; +import java.util.*; + +import static com.alive.db.jooq.Tables.*; + +@Slf4j +@Service +public class PersonalCenterService extends BaseComponent { + + @Autowired + private PersonalCenterMapper personalCenterMapper; + + @Autowired + private MemberService memberService; + + @Autowired + private WalletService walletService; + + public List findTeamRewardVoList(Integer grade) { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + List tMemberRecords = dslContext.select().from(T_MEMBER).where(T_MEMBER.REFER_ID.eq(memberId)).fetchInto(TMemberRecord.class); + if(grade == 2 && tMemberRecords != null && tMemberRecords.size() > 0){ + List userIds = new ArrayList<>(); + for (TMemberRecord user : tMemberRecords){ + userIds.add(user.getId()); + } + tMemberRecords = dslContext.select().from(T_MEMBER).where(T_MEMBER.REFER_ID.in(userIds)).fetchInto(TMemberRecord.class); + } + List list = personalCenterMapper.findTeamRewardVoList(grade,memberId); + List rewardVos = new ArrayList<>(); + for (TMemberRecord tMemberRecord : tMemberRecords){ + TeamRewardVo teamRewardVo = new TeamRewardVo(); + Integer lent = tMemberRecord.getAccount().length(); + teamRewardVo.setAddress(tMemberRecord.getAccount().substring(0,5)+"....."+tMemberRecord.getAccount().substring(lent-5,lent)); + teamRewardVo.setNumber("0"); + for(TeamRewardVo teamReward : list){ + if(tMemberRecord.getAccount().equals(teamReward.getAddress())){ + teamRewardVo.setNumber(new BigDecimal(teamReward.getNumber()).stripTrailingZeros().toPlainString()); + } + } + rewardVos.add(teamRewardVo); + } + return rewardVos; + } + + /** + * 查询个人中心数据 + */ + public RecommendVo referralReward() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + RecommendVo recommendVo = personalCenterMapper.referralReward(memberId); + recommendVo = recommendVo == null ? new RecommendVo().setRebate("0").setOneBrit("0").setOneNft("0").setTwoBrit("0").setTwoNft("0") : recommendVo; + recommendVo.setInvitationCode(memberService.fetchOne(memberId).getShareCode()); + recommendVo.setRebate(new BigDecimal(recommendVo.getRebate()).intValue()+"%"); + recommendVo.setOneBrit(new BigDecimal(recommendVo.getOneBrit()).intValue()+"%"); + recommendVo.setOneNft(new BigDecimal(recommendVo.getOneNft()).intValue()+"%"); + recommendVo.setTwoBrit(new BigDecimal(recommendVo.getTwoBrit()).intValue()+"%"); + recommendVo.setTwoNft(new BigDecimal(recommendVo.getTwoNft()).intValue()+"%"); + //查询推荐奖励 + RecommendVo recommend = personalCenterMapper.rewardStatisticsByRecommendId(memberId); + recommend = recommend == null ? new RecommendVo() : recommend; + recommendVo.setOneNftAmount(new BigDecimal(recommend.getOneNftAmount()).stripTrailingZeros().toPlainString()); + recommendVo.setBitAmount(new BigDecimal(recommend.getBitAmount()).stripTrailingZeros().toPlainString()); + recommendVo.setUsdtAmount(new BigDecimal(recommend.getUsdtAmount()).stripTrailingZeros().toPlainString()); + + RecommendVo indirectUser = personalCenterMapper.rewardStatisticsByIndirectUserId(memberId); + String amount = personalCenterMapper.sumRbitAmountById(memberId); + indirectUser = indirectUser == null ? new RecommendVo() : indirectUser; + recommendVo.setTwoNftAmount(new BigDecimal(indirectUser.getTwoNftAmount()).stripTrailingZeros().toPlainString()); + recommendVo.setBitAmount((new BigDecimal(indirectUser.getBitAmount()).add(new BigDecimal(recommendVo.getBitAmount())) + .add(new BigDecimal(amount))).stripTrailingZeros().toPlainString()); + return recommendVo; + } + + public String minerFittings() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + TMemberWalletRecord tMemberWalletRecord = walletService.getWallet(memberId,CoinUtil.getCoinMap().get("NFTCHIP")); + return tMemberWalletRecord.getBalance().stripTrailingZeros().toPlainString(); + } + + public MyIntegralVo myBonusPoints() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + MyIntegralVo myIntegralVo = personalCenterMapper.myBonusPoints(memberId, CoinUtil.getCoinMap().get("POINTS")); + myIntegralVo.setMyIntegral(new BigDecimal(myIntegralVo.getMyIntegral()).stripTrailingZeros().toPlainString()); + myIntegralVo.setRecommendationPoints(new BigDecimal(myIntegralVo.getRecommendationPoints()).stripTrailingZeros().toPlainString()); + myIntegralVo.setIVeFinished(new BigDecimal(myIntegralVo.getIVeFinished()).stripTrailingZeros().toPlainString()); + myIntegralVo.setRecommend(new BigDecimal(myIntegralVo.getRecommend()).stripTrailingZeros().toPlainString()); + return myIntegralVo; + } + + public List recommendedCompletionList(BasePageReq basePageReq) { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + List taskVos = personalCenterMapper.recommendedCompletionList(memberId,basePageReq.getOffset(),basePageReq.getSize()); + for (TaskVo task : taskVos){ + Integer lent = task.getAddress().length(); + task.setAddress(task.getAddress().substring(0,5)+"....."+task.getAddress().substring(lent-5,lent)); + task.setNumber(new BigDecimal(task.getNumber()).stripTrailingZeros().toPlainString()); + } + return taskVos; + } + + public List nodeTask() { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + List taskVos = new ArrayList<>(); + List nodeTaskRecords = dslContext.select().from(NODE_TASK).where().fetchInto(NodeTaskRecord.class); + List logs = dslContext.select().from(NODE_TASK_LOG).where(NODE_TASK_LOG.MEMBER_ID.eq(memberId).and(NODE_TASK_LOG.STATE.in(1,2))).fetchInto(NodeTaskLogRecord.class); + for (NodeTaskRecord nodeTaskRecord : nodeTaskRecords){ + NodeTaskVo nodeTaskVo = new NodeTaskVo(); + nodeTaskVo.setNumber(nodeTaskRecord.getAwardValue().stripTrailingZeros().toPlainString()); + nodeTaskVo.setType(nodeTaskRecord.getType()); + nodeTaskVo.setState(0); + nodeTaskVo.setCoinName(CoinUtil.getCoinName(nodeTaskRecord.getCoinId())); + for (NodeTaskLogRecord log : logs){ + if(nodeTaskRecord.getId().equals(log.getTaskId())){ + nodeTaskVo.setState(log.getState()); + nodeTaskVo.setId(log.getId()); + nodeTaskVo.setCoinName(log.getCoinName()); + } + } + taskVos.add(nodeTaskVo); + } + return taskVos; + } + + public Map taskReward(TeskReq req) { + int memberId = Integer.parseInt(RequestUtil.getCurrentAccount()); + TMemberRecord tMemberRecord = memberService.fetchOne(memberId); + NodeTaskLogRecord logs = dslContext.select().from(NODE_TASK_LOG).where(NODE_TASK_LOG.MEMBER_ID.eq(memberId).and(NODE_TASK_LOG.ID.eq(req.getId()))).fetchAnyInto(NodeTaskLogRecord.class); + Assert.isTrue(logs != null && logs.getMemberId().equals(memberId), "Order does not exist"); + Assert.isTrue(logs.getState().equals(1), "Unable to claim rewards"); + logs.setState(2); + logs.store(); + + //购买盒子获取Rbit奖励数量 + TMemberWalletRecord walletRecord= walletService.getWallet(memberId, CoinUtil.getCoinMap().get(logs.getCoinName())); + WalletOperation walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.TASK_REWARD,logs.getAwardValue(),"领取任务奖励"); + walletService.operateBalance(walletOperation); + + //给推荐人奖励 + if(logs.getRecommendValue().compareTo(BigDecimal.ZERO) != 0 && tMemberRecord.getReferId() > 0){ + walletRecord= walletService.getWallet(tMemberRecord.getReferId(), CoinUtil.getCoinMap().get(logs.getCoinName())); + walletOperation = WalletOperation.buildParam(1,walletRecord.getId(), WalletLogTypeEnum.RECOMMENDER_ASSIGNMENT_REWARD,logs.getAwardValue(),"推荐人任务奖励"); + walletService.operateBalance(walletOperation); + } + return (Map) new TreeMap<>().put("result",true); + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/SysConfigService.java b/alive-api/src/main/java/com/alive/server/service/SysConfigService.java new file mode 100644 index 0000000..4abb987 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/SysConfigService.java @@ -0,0 +1,93 @@ +package com.alive.server.service; + +import com.alive.commons.util.JsonUtil; +import com.alive.commons.util.RedisUtil; +import com.alive.db.jooq.tables.pojos.SysConfigPojo; +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +import static com.alive.db.jooq.Tables.SYS_CONFIG; + +@Slf4j +@Service +public class SysConfigService { + + @Autowired + private DSLContext dslContext; + + public BigDecimal getNumValue(String key, BigDecimal _default) { + BigDecimal result = getNumValue(key); + return result != null ? result : _default; + } + + //获取数字 + public BigDecimal getNumValue(String key) { + SysConfigPojo entity = getEntityWithCache(key); + if (entity == null || entity.getValue() == null || entity.getValue().isEmpty()) { + return null; + } + return new BigDecimal(entity.getValue()); + } + + //获取百分数,未乘100,1% -> 0.01 + public BigDecimal getPercentValue(String key) { + SysConfigPojo entity = getEntityWithCache(key); + if (entity == null) { + return null; + } + + return new BigDecimal(entity.getValue()); + } + + //获取字符串配置 + public String getStringValue(String key) { + SysConfigPojo entity = getEntityWithCache(key); + if (entity == null) { + return null; + } + return entity.getValue(); + } + + //获取json配置,获取后需要强转 + public Object getObjectValue(String key, Class targetClass) { + SysConfigPojo entity = getEntityWithCache(key); + if (entity == null) { + return null; + } + return JsonUtil.fromJson(entity.getValue(), targetClass); + } + + public Integer getIntValue(String key) { + SysConfigPojo entity = getEntityWithCache(key); + if (entity == null) { + return null; + } + return Integer.parseInt(entity.getValue()); + } + + private SysConfigPojo getEntityWithCache(String key) { + String cacheKey = "ids:sysConfig:" + key; + String cacheValue = RedisUtil.get(cacheKey); + if (cacheValue != null) { + return JsonUtil.fromJson(cacheValue, SysConfigPojo.class); + } + SysConfigPojo entity = dslContext.selectFrom(SYS_CONFIG) + .where(SYS_CONFIG.CONFIG_KEY.eq(key)) + .fetchAnyInto(SysConfigPojo.class); + + RedisUtil.setEx(cacheKey, JsonUtil.toJson(entity), 5); + return entity; + } + + public void update(String key, String value) { + dslContext.update(SYS_CONFIG) + .set(SYS_CONFIG.VALUE, value) + .where(SYS_CONFIG.CONFIG_KEY.eq(key)) + .execute(); + } + +} diff --git a/alive-api/src/main/java/com/alive/server/service/TaskService.java b/alive-api/src/main/java/com/alive/server/service/TaskService.java new file mode 100644 index 0000000..0e6010c --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/TaskService.java @@ -0,0 +1,291 @@ +package com.alive.server.service; + + +import com.alive.server.dto.*; +import com.alive.commons.util.DateUtils; +import com.alive.db.jooq.tables.records.ActivityLogRecord; +import com.alive.server.config.DiscordConfig; +import com.alive.server.config.TwitterConfig; +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Timestamp; +import java.util.*; + +import static com.alive.db.jooq.Tables.*; + + +@Slf4j +@Service +public class TaskService { + + @Autowired + private DSLContext dslContext; + + @Autowired + private TwitterService twitterService; + + @Autowired + private DiscordService discordService; + + @Autowired + private TelegramServer telegramServer; + + /** + * 检测用户是否完成任务 关注、改名 + */ + public void optimismExec() { + List activityLogRecords = dslContext.selectFrom(ACTIVITY_LOG).where(ACTIVITY_LOG.TYPE.eq(1) + .and(ACTIVITY_LOG.CONFIG_TYPE.in(1,5))).fetch(); + if(activityLogRecords == null || activityLogRecords.size() <= 0){ + return; + } + for (ActivityLogRecord log : activityLogRecords){ + if(log.getConfigType().equals(1)){ + //执行检查关注操作 + String accessToken = TwitterConfig.getAccessToken(log.getAddress()); + //重新刷新token + if(accessToken == null && twitterService.requestBearerToken(log.getAddress(),null) == null){ + continue; + } + accessToken = TwitterConfig.getAccessToken(log.getAddress()); + //查询用户自己的账号 + TwitterUserDto twitterUserDto = twitterService.getUserInfoByToken(accessToken); + //执行关注 + AttentionDto attentionDto = twitterService.attention(accessToken,twitterUserDto.getId(),TwitterConfig.DEVELOPERS); + if(attentionDto != null && attentionDto.getFollowing()){ + log.setType(2); + }else{ + log.setType(3); + } + }else{ + String accessToken = TwitterConfig.getAccessToken(log.getAddress()); + //重新刷新token + if(accessToken == null && twitterService.requestBearerToken(log.getAddress(),null) == null){ + continue; + } + accessToken = TwitterConfig.getAccessToken(log.getAddress()); + TwitterUserDto twitterUserDto = twitterService.getUserInfoByToken(accessToken); + //需要修改推特的后缀名 + String name = log.getMark(); + String twitterName = twitterUserDto.getName().substring(twitterUserDto.getName().length() - name.length(),twitterUserDto.getName().length()); + if(name.toLowerCase().equals(twitterName.toLowerCase())){ + //任务完成 + log.setType(2); + //更新用户推特信息 + dslContext.update(T_MEMBER).set(T_MEMBER.TWITTER_IMG,twitterUserDto.getImg()).set(T_MEMBER.TWITTER_NAME,twitterUserDto.getName()) + .set(T_MEMBER.TWITTER_USER_NAME,twitterUserDto.getUsername()).set(T_MEMBER.TWITTER_ID,twitterUserDto.getId()) + .where(T_MEMBER.ACCOUNT.eq(log.getAddress())).execute(); + + } + } + if(log.getType().equals(1) && DateUtils.addMinute(log.getCreateTime(),120).getTime() < System.currentTimeMillis()){ + //任务创建超过2小时,任务失败 + log.setType(3); + } + //更新数据 + if(log.getType().equals(2) || log.getType().equals(3)){ + log.store(); + } + if(log.getType().equals(2)){ + //增加用户资产统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getSuperiorAddress())).execute(); + } + } + } + + /** + * 检测用户是否完成任务 转载、点赞 + */ + public void activeExec() { + List activityLogRecords = dslContext.select(ACTIVITY_LOG.ID.as("id"), + ACTIVITY_LOG.CREATE_TIME.as("createTime"),ACTIVITY_LOG.ACTIVITY_CONFIG_ID.as("activityConfigId") + ,ACTIVITY_LOG.ADDRESS.as("address"),ACTIVITY_LOG.TYPE.as("type") + ,ACTIVITY_LOG.AMOUNT.as("amount"),ACTIVITY_LOG.SUPERIOR_AMOUNT.as("superiorAmount"),ACTIVITY_LOG.SUPERIOR_ADDRESS.as("superiorAddress"),ACTIVITY_LOG.CONFIG_TYPE.as("configType") + ,ACTIVITY_LOG.MARK.as("mark"),T_MEMBER.TWITTER_ID.as("twitterId")) + .from(ACTIVITY_LOG).leftJoin(T_MEMBER).on( + ACTIVITY_LOG.ADDRESS.eq(T_MEMBER.ACCOUNT)).where(ACTIVITY_LOG.TYPE.eq(1) + .and(ACTIVITY_LOG.CONFIG_TYPE.in(2,3,5))).fetchInto(TwitterTransshipmentDto.class); + if(activityLogRecords == null || activityLogRecords.size() <= 0){ + return; + } + + //推文ID+推特ID == 点赞的用户 + Map thumbsUpmap = new HashMap<>(); + { + //点赞的推文id + Set thumbsUp = new HashSet<>(); + //推特ID == 用户地址 + Map twitterMap = new HashMap<>(); + activityLogRecords.forEach(a -> { + if(a.getConfigType().equals(3)){ + thumbsUp.add(a.getMark()); + twitterMap.put(a.getTwitterId(),a.getAddress()); + } + }); + + for (String key : twitterMap.keySet()){ + String twId = key; + String address = twitterMap.get(key); + //查询出该推特用户 点赞了那些文章,返回推文的ID + List ids = twitterService.thumbsUpListByTwitterId(twId,TwitterConfig.getAccessToken(address)); + if(ids == null){ + continue; + } + //查询推特那些用户进行的点赞 + for (String id : ids){ + thumbsUpmap.put(id+twId,address); + } + } + } + + //推文ID+推特ID == 转载的用户 + Map transshipmentMap = new HashMap<>(); + { + //转载的推文id + Set transshipment = new HashSet<>(); + activityLogRecords.forEach(a -> { + if(a.getConfigType().equals(2)){ + transshipment.add(a.getMark()); + } + }); + //查询推特那些用户进行的转载 + for (String twid : transshipment){ + List list = twitterService.transmitUserList(twid); + if(list == null){ + continue; + } + list.forEach(t ->{ + transshipmentMap.put(twid+t.getId(),"1"); + }); + } + } + + for (TwitterTransshipmentDto log : activityLogRecords){ + ActivityLogRecord logRecord = dslContext.newRecord(ACTIVITY_LOG); + logRecord.setId(log.getId()); + if(log.getConfigType().equals(2)){ + //执行检查推文转载 + String value = transshipmentMap.get(log.getMark()+log.getTwitterId()); + logRecord.setType(value != null ? 2 : log.getType()); + }else if(log.getConfigType().equals(3)){ + String value = thumbsUpmap.get(log.getMark()+log.getTwitterId()); + logRecord.setType(value != null ? 2 : log.getType()); + } + logRecord.setEndTime(new Timestamp(System.currentTimeMillis())); + if(logRecord.getType() != null && logRecord.getType().equals(2)){ + //增加用户资产统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getSuperiorAddress())).execute(); + //更新数据 + logRecord.update(); + }else if(log.getType().equals(1) && DateUtils.addMinute(log.getCreateTime(),120).getTime() < System.currentTimeMillis()){ + //任务创建超过2小时,任务失败 + logRecord.setType(3); + logRecord.update(); + } + } + } + + + /** + * 加入Discord + */ + public void addDiscord() { + List activityLogRecords = dslContext.select(ACTIVITY_LOG.ID.as("id"),ACTIVITY_LOG.ACTIVITY_CONFIG_ID.as("activityConfigId") + ,ACTIVITY_LOG.ADDRESS.as("address"),ACTIVITY_LOG.TYPE.as("type") + ,ACTIVITY_LOG.AMOUNT.as("amount"),ACTIVITY_LOG.CREATE_TIME.as("createTime"),ACTIVITY_LOG.SUPERIOR_AMOUNT.as("superiorAmount"),ACTIVITY_LOG.SUPERIOR_ADDRESS.as("superiorAddress"), + ACTIVITY_LOG.CONFIG_TYPE.as("configType"),ACTIVITY_LOG.MARK.as("mark"),T_MEMBER.DISCORD_ID.as("discordId")) + .from(ACTIVITY_LOG).leftJoin(T_MEMBER).on( + ACTIVITY_LOG.ADDRESS.eq(T_MEMBER.ACCOUNT)).where(ACTIVITY_LOG.TYPE.eq(1) + .and(ACTIVITY_LOG.CONFIG_TYPE.in(6))).fetchInto(DiscordTransshipmentDto.class); + if(activityLogRecords == null || activityLogRecords.size() <= 0){ + return; + } + + for (DiscordTransshipmentDto log : activityLogRecords){ + ActivityLogRecord logRecord = dslContext.newRecord(ACTIVITY_LOG); + logRecord.setId(log.getId()); + Boolean outcome = discordService.joinConfirmation(log.getAddress(), DiscordConfig.CHANNEL_ID); + if(outcome){ + logRecord.setType(2); + log.setType(2); + } + if(log.getType().equals(1) && DateUtils.addMinute(log.getCreateTime(),120).getTime() < System.currentTimeMillis()){ + //任务创建超过2小时,任务失败 + logRecord.setType(3); + log.setType(3); + } + if(!log.getType().equals(1)){ + logRecord.update(); + } + + if(log.getType().equals(2)){ + //增加用户资产统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getSuperiorAddress())).execute(); + } + } + } + + /** + * 乐观验证 + */ + public void optimisticValidation() { + List logRecords = dslContext.select(ACTIVITY_LOG.ID,ACTIVITY_LOG.ADDRESS,ACTIVITY_LOG.AMOUNT,ACTIVITY_LOG.SUPERIOR_ADDRESS,ACTIVITY_LOG.SUPERIOR_AMOUNT). + from(ACTIVITY_LOG).where(ACTIVITY_LOG.CONFIG_TYPE.in(4,7).and(ACTIVITY_LOG.TYPE.eq(1))).fetchInto(ActivityLogRecord.class); + if(logRecords != null && logRecords.size() > 0){ + List ids = new ArrayList<>(); + for (ActivityLogRecord log : logRecords){ + ids.add(log.getId()); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getSuperiorAddress())).execute(); + } + dslContext.update(ACTIVITY_LOG).set(ACTIVITY_LOG.TYPE,2).where(ACTIVITY_LOG.ID.in(ids)).execute(); + } + } + + /** + * 加入TG + */ + public void addTg() { + List activityLogRecords = dslContext.select(ACTIVITY_LOG.ID.as("id"),ACTIVITY_LOG.ACTIVITY_CONFIG_ID.as("activityConfigId") + ,ACTIVITY_LOG.ADDRESS.as("address"),ACTIVITY_LOG.TYPE.as("type") + ,ACTIVITY_LOG.AMOUNT.as("amount"),ACTIVITY_LOG.CREATE_TIME.as("createTime"),ACTIVITY_LOG.SUPERIOR_AMOUNT.as("superiorAmount"),ACTIVITY_LOG.SUPERIOR_ADDRESS.as("superiorAddress"), + ACTIVITY_LOG.CONFIG_TYPE.as("configType"),ACTIVITY_LOG.MARK.as("mark"),T_MEMBER.TG_ID.as("tgId")) + .from(ACTIVITY_LOG).leftJoin(T_MEMBER).on( + ACTIVITY_LOG.ADDRESS.eq(T_MEMBER.ACCOUNT)).where(ACTIVITY_LOG.TYPE.eq(1) + .and(ACTIVITY_LOG.CONFIG_TYPE.in(10))).fetchInto(DiscordTransshipmentDto.class); + if(activityLogRecords == null || activityLogRecords.size() <= 0){ + return; + } + + for (DiscordTransshipmentDto log : activityLogRecords){ + ActivityLogRecord logRecord = dslContext.newRecord(ACTIVITY_LOG); + logRecord.setId(log.getId()); + if(log.getTgId() != null){ + Boolean outcome = telegramServer.joinConfirmation(log.getTgId()); + if(outcome){ + logRecord.setType(2); + log.setType(2); + } + } + if(log.getType().equals(1) && DateUtils.addMinute(log.getCreateTime(),120).getTime() < System.currentTimeMillis()){ + //任务创建超过2小时,任务失败 + logRecord.setType(3); + log.setType(3); + } + if(!log.getType().equals(1)){ + logRecord.update(); + } + if(log.getType().equals(2)){ + //增加用户资产统计 + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getAddress())).execute(); + dslContext.update(ACTIVITY_STATISTICS).set(ACTIVITY_STATISTICS.AMOUNT,ACTIVITY_STATISTICS.AMOUNT.add(log.getSuperiorAmount())).where(ACTIVITY_STATISTICS.ADDRESS.eq(log.getSuperiorAddress())).execute(); + } + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/TelegramServer.java b/alive-api/src/main/java/com/alive/server/service/TelegramServer.java new file mode 100644 index 0000000..5b173b0 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/TelegramServer.java @@ -0,0 +1,174 @@ +package com.alive.server.service; + +import com.alive.server.config.TelegramConfig; +import lombok.extern.slf4j.Slf4j; +import lombok.var; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.telegram.telegrambots.bots.TelegramLongPollingBot; +import org.telegram.telegrambots.meta.api.methods.groupadministration.GetChatMember; +import org.telegram.telegrambots.meta.api.methods.send.SendMessage; +import org.telegram.telegrambots.meta.api.objects.Message; +import org.telegram.telegrambots.meta.api.objects.Update; +import org.telegram.telegrambots.meta.api.objects.chatmember.ChatMember; +import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; +import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton; +import org.telegram.telegrambots.meta.exceptions.TelegramApiException; + +import java.util.ArrayList; +import java.util.List; + +import static com.alive.db.jooq.Tables.T_MEMBER; + + +@Slf4j +@Service +@Component +public class TelegramServer extends TelegramLongPollingBot { + + @Autowired + private DSLContext dslContext; + + @Autowired + public TelegramServer(DSLContext dslContext) { + this.dslContext = dslContext; + } + + private InlineKeyboardMarkup keyboardM1; + + @Override + public void onUpdateReceived(Update update) { + var msg = update.getMessage(); + if(msg == null){ + return; + } + var user = msg.getFrom(); + //用户发送的消息,消息长度必须大于10以上 /start 0x505f87Bc247c907dc8005fC5d60d020Ae459CE09 + String text = msg.getText(); + if(user == null || text == null || text.length() < 10){ + return; + } + if (msg.getText().substring(0,6).equals("/start")) { + //获取到用户的地址 + String address = msg.getText().substring(7,msg.getText().length()).toLowerCase(); + //获取到用户的TG id + Long tgUserId = user.getId(); + String userAddress = dslContext.select(T_MEMBER.ACCOUNT).from(T_MEMBER).where(T_MEMBER.TG_ID.eq(tgUserId.toString())).limit(1).fetchAnyInto(String.class); + if(userAddress != null){ + //该TG账号已经被绑定过了,绑定地址为: userAddress + this.sendText(user.getId(),"Your account has been bound to an address 【"+userAddress+"】"); + return; + } + //开始绑定用户地址 + Integer outcome = dslContext.update(T_MEMBER).set(T_MEMBER.TG_ID,tgUserId.toString()).where(T_MEMBER.ACCOUNT.eq(address)).execute(); + if(outcome <= 0){ + //该账号不存在 + this.sendText(user.getId(),"The account is not registered"); + return; + } + InlineKeyboardButton joinUs = InlineKeyboardButton.builder() + .text("加入我们") + .url(TelegramConfig.ADD_TG_URL) + .build(); + //此按钮 Tutorial 点击可以跳转到地址https://core.telegram.org/bots/api + InlineKeyboardButton url = InlineKeyboardButton.builder() + .text("官网链接") + .url(TelegramConfig.APP_TG_URL) + .build(); + List list = new ArrayList<>(); + list.add(joinUs); + list.add(url); + keyboardM1 = InlineKeyboardMarkup.builder() + .keyboardRow(list).build(); + sendMenu(user.getId(), "欢迎加入roos官网TG,请根据需求进行以下操作",keyboardM1); + + + } + } + + /** + * 发送消息到用户或者频道 后面是消息内容 + * @param id + * @param txt + * @param kb 消息下面跟着几个按钮可以点击的 + */ + public void sendMenu(Long id, String txt, InlineKeyboardMarkup kb){ + SendMessage sm = SendMessage.builder().chatId(id.toString()) + .parseMode("HTML").text(txt) + .replyMarkup(kb).build(); + + try { + execute(sm); + } catch (TelegramApiException e) { + throw new RuntimeException(e); + } + } + + /** + * 发送消息到用户或者频道 后面是消息内容 + * @param id + * @param msg + */ + private void scream(Long id, Message msg) { + if(msg.hasText()){ + sendText(id, msg.getText().toLowerCase()); + } else{ + //copyMessage(id, msg.getMessageId()); //We can't really scream a sticker + } + } + + /** + * 发送消息到用户或者频道 后面是消息内容 + * @param id + * @param what + */ + public void sendText(Long id, String what){ + SendMessage sm = SendMessage.builder() + .chatId(id.toString()) + .text(what).build(); + try { + execute(sm); + } catch (TelegramApiException e) { + throw new RuntimeException(e); + } + } + + @Override + public String getBotUsername() { + // 返回您的机器人的用户名 + return TelegramConfig.TG_BOT_NAME; + } + + @Override + public String getBotToken() { + // 返回您的机器人的令牌 + return TelegramConfig.TG_BOT_TOKEN; + } + + public Boolean joinConfirmation(String tgId) { + // 处理接收到的消息 -1002019878988 6174699932 + // 创建一个 GetChatMembersCount 对象 5331549827 + // 使用 execute 方法发送请求并获取 ChatMembersCount 对象 + try { //创造者:creator 成员:member 未加入的:left left + // 创建一个 GetChatMember 对象 + GetChatMember getChatMember = new GetChatMember(TelegramConfig.TG_BOT_TEAM_ID, Long.parseLong(tgId)); + // 使用 execute 方法发送请求并获取 ChatMember 对象 + ChatMember chatMember = execute(getChatMember); + String status = chatMember.getStatus().toLowerCase(); + //Creator: 聊天创建者 + //Administrator: 管理员 + //Member: 普通成员 + //Restricted: 受限成员 + //Left: 已退出聊天 + //Kicked: 已踢出聊天 + if(status.equals("creator") || status.equals("administrator") || status.equals("member")){ + return true; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return false; + } +} diff --git a/alive-api/src/main/java/com/alive/server/service/TokenTransferServer.java b/alive-api/src/main/java/com/alive/server/service/TokenTransferServer.java new file mode 100644 index 0000000..e69f114 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/TokenTransferServer.java @@ -0,0 +1,114 @@ +package com.alive.server.service; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.web3j.abi.FunctionEncoder; +import org.web3j.abi.TypeReference; +import org.web3j.abi.datatypes.Address; +import org.web3j.abi.datatypes.Function; +import org.web3j.abi.datatypes.Type; +import org.web3j.abi.datatypes.Uint; +import org.web3j.abi.datatypes.generated.Uint256; +import org.web3j.crypto.Credentials; +import org.web3j.crypto.RawTransaction; +import org.web3j.crypto.TransactionEncoder; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.DefaultBlockParameterName; +import org.web3j.protocol.core.methods.request.Transaction; +import org.web3j.protocol.core.methods.response.EthEstimateGas; +import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt; +import org.web3j.protocol.core.methods.response.EthSendTransaction; +import org.web3j.protocol.core.methods.response.TransactionReceipt; +import org.web3j.protocol.http.HttpService; +import org.web3j.tx.gas.ContractGasProvider; +import org.web3j.tx.gas.DefaultGasProvider; +import org.web3j.utils.Numeric; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.concurrent.ExecutionException; + +@Slf4j +@Service +@Component +public class TokenTransferServer { + + /** + * 节点的 RPC URL + */ + @Value("${chain.transfer.rpcUrl}") + private String rpcUrl; + + /** + * ERC-20代币合约地址 + */ + @Value("${chain.transfer.erc20}") + private String contractAddress; + + /** + * 发送方的私钥 + */ + @Value("${chain.transfer.privateKey}") + private String privateKey; + + + /** + * ERC20转账到指定地址 + * @param amount + * @param toAddress + */ + public String transferTo(BigDecimal amount, String toAddress, Integer non) { + try { + Web3j web3j = Web3j.build(new HttpService(rpcUrl)); + Credentials credentials = Credentials.create(privateKey); + Function function = new Function( + "transfer", + Arrays.asList(new Address(toAddress), new Uint256(amount.toBigInteger())), + Collections.emptyList() + ); + String encodedFunction = FunctionEncoder.encode(function); + BigInteger gasLimit = BigInteger.valueOf(21000); + BigInteger nonce = web3j.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName.PENDING).send().getTransactionCount().add(new BigInteger(non.toString())); + BigInteger gasPrice = web3j.ethGasPrice().send().getGasPrice(); + RawTransaction rawTransaction = RawTransaction.createTransaction( + nonce, + gasPrice, + gasLimit, + contractAddress, + encodedFunction + ); + byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials); + String hexValue = Numeric.toHexString(signedMessage); + EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).send(); + if (ethSendTransaction.hasError()) { + if(ethSendTransaction.getError().getMessage().equals("nonce too low")){ + return this.transferTo(amount, toAddress, non + 1); + } else { + log.error("Token transfer failed. Error: {}", ethSendTransaction.getError().getMessage()); + } + } else { + String transactionHash = ethSendTransaction.getTransactionHash(); + // 等待交易确认3秒,不然nonce确认不过来,会导致错误 + Thread.sleep(3000); + EthGetTransactionReceipt receipt = web3j.ethGetTransactionReceipt(transactionHash).send(); + if (receipt.getTransactionReceipt().isPresent()) { + log.info("Transaction confirmed. Hash: {}", transactionHash); + } else { + log.warn("Transaction might not be confirmed yet. Hash: {}", transactionHash); + } + return transactionHash; + } + } catch (Exception e) { + log.error("ERC20转账错误: {}", e.getMessage()); + } + return null; + } + + + +} + diff --git a/alive-api/src/main/java/com/alive/server/service/TwitterService.java b/alive-api/src/main/java/com/alive/server/service/TwitterService.java new file mode 100644 index 0000000..f742914 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/TwitterService.java @@ -0,0 +1,633 @@ +package com.alive.server.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alive.server.dto.AttentionDto; +import com.alive.server.dto.TransshipmentUserDto; +import com.alive.server.dto.TwitterDto; +import com.alive.server.dto.TwitterUserDto; +import com.alive.commons.config.BaseComponent; +import com.alive.server.config.TwitterConfig; +import lombok.extern.slf4j.Slf4j; +import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer; +import oauth.signpost.exception.OAuthCommunicationException; +import oauth.signpost.exception.OAuthExpectationFailedException; +import oauth.signpost.exception.OAuthMessageSignerException; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.io.*; +import java.net.*; +import java.util.*; + +import static com.alive.db.jooq.Tables.T_MEMBER; + + +@Slf4j +@Service +public class TwitterService extends BaseComponent { + + @Autowired + private DSLContext dslContext; + + public static String codeChallenge = "0ioze5m20493ny2"; + + /** + * 生成推文转发链接 + * @param authorizationReq + * @return + */ + /* public String getTtTweetsUrl(TwitterAuthorizationReq authorizationReq){ + String url = "https://twitter.com/"; + MerchantPojo merchantPojo = merchantService.getMerchant(authorizationReq.getCodeNo(),authorizationReq.getMerchantOn()); + MerchantConfigPojo merchantConfigPojo = merchantService.getMerchantConfig(merchantPojo.getId()); + url += merchantConfigPojo.getTtUserName(); + url += "/status/" + merchantConfigPojo.getTtTweetsId() +"?s=20"; + return url; + }*/ + + /** + * 返回授权的地址 + * @param address + * @return + */ + public String getAuthorizationUrl(String address){ + String url = "https://twitter.com/i/oauth2/authorize?"; + url += "client_id="+ TwitterConfig.CLIENT_ID; + //访问权限 + url += "&scope="+ "tweet.read%20tweet.write%20offline.access%20tweet.moderate.write%20users.read%20follows.read%20follows.write%20like.read"; + url += "&response_type=code"; + //回调地址 + url += "&redirect_uri="+TwitterConfig.CALLBACK_URL; + //用户地址 + url += "&state="+address; + url += "&code_challenge="+codeChallenge+"&code_challenge_method=plain"; + return url; + } + + /** + * 用户关注 + * @param token 授权换取的用户token + * @param userId 用户自己的ID + * @param targetUserId 被关注的推特用户ID + * @return + * @throws Exception + */ + public AttentionDto attention(String token, String userId, String targetUserId) { + try { + String urlAdress = "https://api.twitter.com/2/users/" + userId + "/following"; + URL url12 = new URL(urlAdress); + HttpURLConnection connection = (HttpURLConnection) url12.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "application/json"); + connection.setRequestProperty("Authorization", "Bearer " + token); + JSONObject requestBody = new JSONObject(); + //需要关注的用户ID + requestBody.put("target_user_id", targetUserId); + String requestBodyString = requestBody.toString(); + connection.setDoOutput(true); + OutputStream outputStream = connection.getOutputStream(); + outputStream.write(requestBodyString.getBytes()); + outputStream.flush(); + outputStream.close(); + + int responseCode = connection.getResponseCode(); + InputStream inputStream; + if (responseCode == 429) { + Assert.notNull(null, "limiting frequency"); + } + if (responseCode >= 200 && responseCode < 400) { + inputStream = connection.getInputStream(); + } else { + inputStream = connection.getErrorStream(); + } + + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + StringBuilder responseBuilder = new StringBuilder(); + while ((line = reader.readLine()) != null) { + responseBuilder.append(line); + } + reader.close(); + String response = responseBuilder.toString(); + if (JSON.parseObject(response).get("data") != null) { + JSONObject json = JSON.parseObject(JSON.parseObject(response).get("data").toString()); + AttentionDto attentionDto = new AttentionDto(); + Object ret = json.get("following"); + attentionDto.setFollowing(Boolean.parseBoolean(ret == null ? "false" : ret.toString())); + ret = json.get("pending_follow"); + attentionDto.setPending_follow(Boolean.parseBoolean(ret == null ? "false" : ret.toString())); + return attentionDto; + } + return null; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 根据code获取用户token + * @param address 授权地址 + * @param code 获取token + * @return + */ + public TwitterDto requestBearerToken(String address, String code) { + try { + TwitterDto twitterDto = new TwitterDto(); + String clientId = URLEncoder.encode(TwitterConfig.CLIENT_ID, "UTF-8"); + String clientSecret = URLEncoder.encode(TwitterConfig.CLIENT_SECRET, "UTF-8"); + String credentials = clientId + ":" + clientSecret; + String base64Credentials = Base64.getEncoder().encodeToString(credentials.getBytes()); + + String redirectURI = TwitterConfig.CALLBACK_URL; + URL url = new URL("https://api.twitter.com/2/oauth2/token"); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Authorization", "Basic " + base64Credentials); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + connection.setDoOutput(true); + connection.setDoInput(true); + String data = ""; + String refreshToken = TwitterConfig.getRefreshToken(address); + String accessToken = TwitterConfig.getAccessToken(address); + if(!StringUtils.isBlank(refreshToken) && !StringUtils.isBlank(accessToken)){ + //避免用户重复获取token + twitterDto.setAccessToken(accessToken); + twitterDto.setRefreshToken(refreshToken); + return twitterDto; + } + if(StringUtils.isBlank(refreshToken) && code == null){ + return null; + } + if(StringUtils.isBlank(refreshToken) && code != null){ + String grantType = "authorization_code"; + //获取令牌需要的参数 code_verifier 需要和获取code传入参数 code_challenge 保持一致 + data = "grant_type=" + grantType + "&code=" + code + "&redirect_uri=" + redirectURI+ + "&client_id="+TwitterConfig.CLIENT_ID+"&client_secret="+TwitterConfig.CLIENT_SECRET+"&code_verifier="+codeChallenge; + }else{ + String grantType = "refresh_token"; + //刷新令牌需要的参数 + data = "refresh_token="+refreshToken+"&grant_type=" + grantType + "&client_id="+TwitterConfig.CLIENT_ID+ + "&client_secret="+TwitterConfig.CLIENT_SECRET+"&code_verifier="+codeChallenge; + } + connection.getOutputStream().write(data.getBytes("UTF-8")); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + StringBuilder response = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + String jsonResponse = response.toString(); + JSONObject json = JSON.parseObject(jsonResponse); + accessToken = json.getString("access_token"); + twitterDto.setAccessToken(accessToken == null ? null : accessToken); + refreshToken = json.getString("refresh_token"); + twitterDto.setRefreshToken(refreshToken == null ? null : refreshToken); + + TwitterConfig.addAccessToken(address,accessToken,6000); + TwitterConfig.addRefreshToken(address,refreshToken,60 * 60 * 168); + return twitterDto; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 获取开发者推特token + * @return + */ + public String getTwitterToken(){ + try { + String consumerKey = URLEncoder.encode(TwitterConfig.CONSUMER_KEY, "UTF-8"); + String consumerSecret = URLEncoder.encode(TwitterConfig.CONSUMER_SECRET, "UTF-8"); + String credentials = consumerKey + ":" + consumerSecret; + String base64Credentials = Base64.getEncoder().encodeToString(credentials.getBytes()); + //authorization_code、refresh_token、client_credentials + String grantType = "client_credentials"; + URL url = new URL("https://api.twitter.com/oauth2/token"); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Authorization", "Basic " + base64Credentials); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + connection.setDoOutput(true); + connection.setDoInput(true); + String data = "grant_type=" + grantType + + "&client_id="+TwitterConfig.CLIENT_ID+"&client_secret="+TwitterConfig.CLIENT_SECRET+"&code_verifier=challenge"; + connection.getOutputStream().write(data.getBytes("UTF-8")); + + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + StringBuilder response = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + + // Extract bearer token from JSON response + String jsonResponse = response.toString(); + JSONObject json = JSON.parseObject(jsonResponse); + return json.get("access_token").toString(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 获取开发者账号信息 + * @return + */ + public JSONObject getUserInfo() throws Exception { + CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(TwitterConfig.CONSUMER_KEY, TwitterConfig.CONSUMER_SECRET); + consumer.setTokenWithSecret(TwitterConfig.ACCESS_TOKEN, TwitterConfig.ACCESS_TOKEN_SECRET); + // 创建HttpClient对象 + HttpClient httpClient = this.setProxy(); + // 创建API请求,例如获取用户的时间线 + try { + URIBuilder uriBuilder = new URIBuilder("https://api.twitter.com/2/users/me"); + ArrayList queryParameters; + queryParameters = new ArrayList<>(); + queryParameters.add(new BasicNameValuePair("user.fields", "id,name,username,profile_image_url,public_metrics")); + queryParameters.add(new BasicNameValuePair("expansions", "pinned_tweet_id")); + uriBuilder.addParameters(queryParameters); + HttpGet request = new HttpGet(uriBuilder.build()); + request.setHeader("Content-Type","application/json"); + consumer.sign(request); + // 创建参数列表 + HttpResponse response = httpClient.execute(request); + // 处理API响应 + int statusCode = response.getStatusLine().getStatusCode(); + String responseBody = EntityUtils.toString(response.getEntity()); + if (statusCode == 200) { + System.out.println(responseBody); + return JSONObject.parseObject(responseBody); + } else { + System.out.println(responseBody); + return JSONObject.parseObject(responseBody); + } + } catch (OAuthMessageSignerException e) { + e.printStackTrace(); + } catch (OAuthExpectationFailedException e) { + e.printStackTrace(); + } catch (OAuthCommunicationException e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + }catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 设置请求代理 + * @return + */ + private HttpClient setProxy(){ + // 创建HttpClientBuilder对象 + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + HttpClient client = httpClientBuilder.build();; + return client; + } + + + /** + * 根据用户token换取用户信息 + * @param token + * @return + */ + public TwitterUserDto getUserInfoByToken(String token){ + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try { + // Twitter API endpoint + String endpoint = "https://api.twitter.com/2/users/me"; + // 构造带有参数的 URL + String urlWithParams = endpoint + "?user.fields=name,pinned_tweet_id,profile_image_url"; + // 创建 URL 对象 + URL url = new URL(urlWithParams); + URLConnection connection = url.openConnection(); + connection.setRequestProperty("Authorization", "Bearer " + token); + connection.setRequestProperty("Content-Type","application/json"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + TwitterUserDto dto = new TwitterUserDto(); + JSONObject json = JSONObject.parseObject(result.toString()); + JSONObject user = (JSONObject)json.get("data"); + if(user != null){ + dto.setId(user.get("id").toString()); + dto.setName(user.get("name").toString()); + dto.setImg(user.get("profile_image_url").toString()); + dto.setUsername(user.get("username").toString()); + } + return dto; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 换取token查询用户信息 + * @param address + */ + public TwitterUserDto getTwitterToken(String address,String token) { + TwitterUserDto twitterUserDto = this.getUserInfoByToken(token); + Assert.notNull(twitterUserDto, "get twitter user error"); + return twitterUserDto; + } + + /** + * 根据推文ID查询那些用户进行了转发 + * @param tweetId + * @return + */ + public List transmitUserList(String tweetId){ + CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(TwitterConfig.CONSUMER_KEY, TwitterConfig.CONSUMER_SECRET); + consumer.setTokenWithSecret(TwitterConfig.ACCESS_TOKEN, TwitterConfig.ACCESS_TOKEN_SECRET); + // 创建HttpClient对象 + HttpClient httpClient = this.setProxy(); + // 创建API请求,例如获取用户的时间线 + try { + URIBuilder uriBuilder = new URIBuilder("https://api.twitter.com/2/tweets/"+tweetId+"/retweeted_by"); + HttpGet request = new HttpGet(uriBuilder.build()); + request.setHeader("Content-Type","application/json"); + consumer.sign(request); + // 创建参数列表 + HttpResponse response = httpClient.execute(request); + // 处理API响应 + int statusCode = response.getStatusLine().getStatusCode(); + String responseBody = EntityUtils.toString(response.getEntity()); + if (statusCode == HttpURLConnection.HTTP_OK) { + List list = new ArrayList<>(); + // 读取响应 + //默认最大返回100条 + JSONObject array = JSONObject.parseObject(responseBody); + JSONArray arr = array.getJSONArray("data"); + if(arr == null){ + return list; + } + for (int i = 0; i < arr.size(); i++) { + list.add(arr.getObject(i,TransshipmentUserDto.class)); + } + // 打印响应 + return list; + } else { + System.out.println("Failed to fetch data from Twitter API. Response code: " + statusCode); + } + } catch (OAuthMessageSignerException e) { + e.printStackTrace(); + } catch (OAuthExpectationFailedException e) { + e.printStackTrace(); + } catch (OAuthCommunicationException e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + }catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 根据用户token和用户ID查询用户喜欢的推文 + * @param token + * @return + */ + public List thumbsUpListByTwitterId(String twitterId, String token){ + if(twitterId == null || token == null){ + return null; + } + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try { + // Twitter API endpoint + String endpoint = "https://api.twitter.com/2/users/"+twitterId+"/liked_tweets"; + // 构造带有参数的 URL + String urlWithParams = endpoint + "?expansions=edit_history_tweet_ids,referenced_tweets.id"; + // 创建 URL 对象 + URL url = new URL(urlWithParams); + URLConnection connection = url.openConnection(); + connection.setRequestProperty("Authorization", "Bearer " + token); + connection.setRequestProperty("Content-Type","application/json"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + List list = new ArrayList<>(); + JSONObject json = JSONObject.parseObject(result.toString()); + JSONArray twittList = json.getJSONArray("data"); + if(twittList != null && twittList.size() > 0){ + for (int i = 0; i < twittList.size(); i++) { + JSONObject twitt = twittList.getJSONObject(i); + list.add(twitt.getString("id")); + } + return list; + } + return null; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 根据推文ID查询那些用户进行了点赞 + * @param tweetId + * @return + */ + public List thumbsUpList(String tweetId){ + CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(TwitterConfig.CONSUMER_KEY, TwitterConfig.CONSUMER_SECRET); + consumer.setTokenWithSecret(TwitterConfig.ACCESS_TOKEN, TwitterConfig.ACCESS_TOKEN_SECRET); + // 创建HttpClient对象 + HttpClient httpClient = this.setProxy(); + // 创建API请求,例如获取用户的时间线 + try { + URIBuilder uriBuilder = new URIBuilder("https://api.twitter.com/2/tweets/"+tweetId+"/liking_users"); + HttpGet request = new HttpGet(uriBuilder.build()); + request.setHeader("Content-Type","application/json"); + consumer.sign(request); + // 创建参数列表 + HttpResponse response = httpClient.execute(request); + // 处理API响应 + int statusCode = response.getStatusLine().getStatusCode(); + String responseBody = EntityUtils.toString(response.getEntity()); + if (statusCode == HttpURLConnection.HTTP_OK) { + // 读取响应 + //默认最大返回100条 + JSONObject array = JSONObject.parseObject(responseBody); + JSONArray arr = array.getJSONArray("data"); + List list = new ArrayList<>(); + for (int i = 0; i < arr.size(); i++) { + list.add(arr.getObject(i,TransshipmentUserDto.class)); + } + // 打印响应 + return list; + } else { + System.out.println("Failed to fetch data from Twitter API. Response code: " + statusCode); + } + } catch (OAuthMessageSignerException e) { + e.printStackTrace(); + } catch (OAuthExpectationFailedException e) { + e.printStackTrace(); + } catch (OAuthCommunicationException e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + }catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + public void bindUser(String id) { + Integer num = dslContext.selectCount().from(T_MEMBER).where(T_MEMBER.TWITTER_ID.eq(id)).fetchAnyInto(Integer.class); + Assert.isTrue(num == 0,"The account has been linked Twitter"); + } + + + /** + * 查询我的推文列表 + * @param tweetUserId + * @param token + * @param ttTweetsId 平台指定转推文的ID + * @param maxResults = 5-10之间 + * @return + + public Integer getTweetList(String tweetUserId,String token,Integer maxResults,String ttTweetsId){ + try { + String httpUrl = "https://api.twitter.com/2/users/"+ tweetUserId + "/tweets?max_results="+maxResults; + httpUrl += "&expansions=author_id,edit_history_tweet_ids,referenced_tweets.id&tweet.fields=created_at"; + // 只查用户当日的推文 + Instant currentTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).toInstant(ZoneOffset.of("+8")); + DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; + String endTimeRFC3339 = formatter.format(currentTime); + httpUrl += "&start_time="+endTimeRFC3339; + // 构建请求 URL + URL url = new URL(httpUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + // 设置请求方法和请求头 + connection.setRequestMethod("GET"); + connection.setRequestProperty("Authorization", "Bearer " + token); + // 发送请求 + int responseCode = connection.getResponseCode(); + Assert.isTrue(responseCode == HttpURLConnection.HTTP_OK, "get tweet error"); + Integer numer = 0; + // 读取响应 + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String line; + StringBuilder response = new StringBuilder(); + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + JSONObject jsonObject = JSON.parseObject(response.toString()); + JSONArray jsonArray = (JSONArray) jsonObject.get("data"); + if(jsonArray == null){ + return numer; + } + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject json = jsonArray.getJSONObject(i); + JSONArray referencedTweets = json.getJSONArray("referenced_tweets"); + if(referencedTweets != null){ + retweeted: 表示当前推文是转推(Retweet)的引用。 + quoted: 表示当前推文是引用推文(Quote Tweet)的引用。 + replied_to: 表示当前推文是回复(Reply)的引用。 + //上个推文的id + String type = referencedTweets.getJSONObject(0).get("type").toString(); + String id = referencedTweets.getJSONObject(0).get("id").toString(); + if(type.equals("quoted") || type.equals("retweeted") && ttTweetsId.equals(id)){ + //quoted 表示推文是引用 + numer++; + } + } + } + // 打印响应 + return numer; + } catch (IOException e) { + e.printStackTrace(); + } + return 0; + }*/ + + /*private String getFollowers(String url_with_cursor) { + String tweetResponse = null; + HttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.STANDARD).build()) + .build(); + try { + URIBuilder uriBuilder = new URIBuilder(url_with_cursor); + ArrayList queryParameters = new ArrayList<>(); + queryParameters.add(new BasicNameValuePair("user.fields", "username")); + uriBuilder.addParameters(queryParameters); + + HttpGet httpGet = new HttpGet(uriBuilder.build()); + httpGet.setHeader("Authorization", String.format("Bearer %s", "T2xwaGZOazRBbW9USWluSmpueUIwNW51MXhGa1dzWkpWTkgzOFJCdTRyRHNlOjE3MTAzMTk0MDM4NDU6MToxOmF0OjE")); + httpGet.setHeader("Content-Type", "application/json"); + + HttpResponse response = httpClient.execute(httpGet); + HttpEntity entity = response.getEntity(); + if (null != entity) { + tweetResponse = EntityUtils.toString(entity, "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return tweetResponse; + }*/ + + /** + * 查询用户推文列表 + * @param setCodeNo + * @return + + public TgUserReq findChannelMember(AttentionReq setCodeNo) { + String tweetNumber = "tweet_list"+setCodeNo.getAddress(); + String value = RedisUtil.get(tweetNumber); + if(value != null){ + return new TgUserReq().setTwitterNumber(Integer.parseInt(value)); + } + String userId = RedisUtil.get("twitter_user"+setCodeNo.getAddress()); + String tokenKey = RedisUtil.get("twitter_token" + setCodeNo.getAddress()); + MerchantPojo merchantPojo = merchantService.getMerchant(setCodeNo.getCodeNo(),setCodeNo.getMerchantOn()); + MerchantConfigPojo merchantConfigPojo = merchantService.getMerchantConfig(merchantPojo.getId()); + Integer num = this.getTweetList(userId,tokenKey,100,merchantConfigPojo.getTtTweetsId()); + if(num > 0){ + TaskLogRecord memberRecord = dslContext.selectFrom(TASK_LOG).where(TASK_LOG.STATUS.eq(1).and(TASK_LOG.ADDRESS.eq(setCodeNo.getAddress())) + .and(TASK_LOG.TASK_TYPE.eq(1)) + .and(TASK_LOG.CREATE_TIME.between(new Timestamp(com.ruoyi.common.utils.DateUtils.getStartDate(new Date()).getTime()),new Timestamp(com.ruoyi.common.utils.DateUtils.getFinallyDate(new Date()).getTime())))).fetchAny(); + if(memberRecord != null){ + memberRecord.setTaskType(3); + memberRecord.store(); + } + } + RedisUtil.setEx(tweetNumber,num.toString(),60 * 5); + return new TgUserReq().setTwitterNumber(num); + }*/ +} diff --git a/alive-api/src/main/java/com/alive/server/service/WalletService.java b/alive-api/src/main/java/com/alive/server/service/WalletService.java new file mode 100644 index 0000000..9c3b7f2 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/service/WalletService.java @@ -0,0 +1,178 @@ +package com.alive.server.service; + +import com.alive.commons.config.BaseComponent; +import com.alive.commons.enums.WalletLogTypeEnum; +import com.alive.commons.util.CoinUtil; +import com.alive.db.jooq.tables.records.ActivityStatisticsRecord; +import com.alive.db.jooq.tables.records.CoinConfigRecord; +import com.alive.db.jooq.tables.records.TMemberWalletRecord; +import com.alive.server.dto.WalletOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import static com.alive.db.jooq.Tables.*; + +@Slf4j +@Service +public class WalletService extends BaseComponent { + + @Autowired + private WalletService walletService; + + public void initWallet(int memberId,String address) { + //实例化用户资产统计 + ActivityStatisticsRecord statisticsRecord = dslContext.newRecord(ACTIVITY_STATISTICS); + statisticsRecord.setAddress(address); + statisticsRecord.setAmount(BigDecimal.ZERO); + statisticsRecord.store(); + + List configRecords = dslContext.select().from(COIN_CONFIG).fetchInto(CoinConfigRecord.class); + for (CoinConfigRecord configRecord : configRecords) { + TMemberWalletRecord walletRecord = dslContext.newRecord(T_MEMBER_WALLET); + walletRecord.setCoinId(configRecord.getId()); + walletRecord.setBalance(BigDecimal.ZERO); + walletRecord.setMemberId(memberId); + walletRecord.store(); + /*if (!env.equals("prod")) { + BigDecimal gift = BigDecimal.valueOf(10000L); + operateBalance(walletRecord.getId(), WalletLogTypeEnum.ADMIN_ADD, gift, null); + }*/ + } + } + + public TMemberWalletRecord getWallet(int walletId) { + TMemberWalletRecord walletRecord = dslContext.fetchOne(T_MEMBER_WALLET, T_MEMBER_WALLET.ID.eq(walletId)); + return walletRecord; + } + + public TMemberWalletRecord getWallet(Integer memberId, int coinId) { + if (memberId == null) { + return null; + } + TMemberWalletRecord walletRecord = dslContext.selectFrom(T_MEMBER_WALLET).where(T_MEMBER_WALLET.MEMBER_ID.eq(memberId).and(T_MEMBER_WALLET.COIN_ID.eq(coinId))).fetchAny(); + if(walletRecord == null){ + walletRecord = dslContext.newRecord(T_MEMBER_WALLET); + walletRecord.setCoinId(coinId); + walletRecord.setMemberId(memberId); + walletRecord.store(); + } + return walletRecord; + } + + public boolean operateBalance(WalletOperation op) { + return operateBalance(op.getWalletId(), op.getOpType(), op.getOpAmount(), op.getExtRemark()); + } + + public boolean operateBalance(Integer walletId, WalletLogTypeEnum logType, BigDecimal opValue, String extRemark) { + if (walletId == null) { + return false; + } + if (opValue.compareTo(BigDecimal.ZERO) == 0) { + return true; + } + int result = dslContext.update(T_MEMBER_WALLET) + .set(T_MEMBER_WALLET.BALANCE, T_MEMBER_WALLET.BALANCE.add(opValue)) + .where(T_MEMBER_WALLET.ID.eq(walletId).and(T_MEMBER_WALLET.BALANCE.ge(opValue.negate()))) + .execute(); + if (result == 0) { + return false; + } + TMemberWalletRecord walletRecord = getWallet(walletId); + dslContext.insertInto(T_MEMBER_WALLET_LOG) + .set(T_MEMBER_WALLET_LOG.WALLET_ID, walletId) + .set(T_MEMBER_WALLET_LOG.MEMBER_ID, walletRecord.getMemberId()) + .set(T_MEMBER_WALLET_LOG.TYPE, 1) + .set(T_MEMBER_WALLET_LOG.COIN_ID, walletRecord.getCoinId()) + .set(T_MEMBER_WALLET_LOG.OP_VALUE, opValue) + .set(T_MEMBER_WALLET_LOG.OP_BEFORE, walletRecord.getBalance().subtract(opValue)) + .set(T_MEMBER_WALLET_LOG.OP_AFTER, walletRecord.getBalance()) + .set(T_MEMBER_WALLET_LOG.OP_TYPE, logType.getCode()) + .set(T_MEMBER_WALLET_LOG.OP_REMARK, logType.getRemark()) + .set(T_MEMBER_WALLET_LOG.EXT_REMARK, extRemark != null ? extRemark : "") + .execute(); + return true; + } + + public boolean operateFrozen(WalletOperation op) { + return operateFrozen(op.getWalletId(), op.getOpType(), op.getOpAmount(), op.getExtRemark()); + } + + public boolean operateFrozen(Integer walletId, WalletLogTypeEnum logType, BigDecimal opValue, String extRemark) { + if (walletId == null) { + return false; + } + if (opValue.compareTo(BigDecimal.ZERO) == 0) { + return true; + } + int result = dslContext.update(T_MEMBER_WALLET) + .set(T_MEMBER_WALLET.FROZEN, T_MEMBER_WALLET.FROZEN.add(opValue)) + .where(T_MEMBER_WALLET.ID.eq(walletId).and(T_MEMBER_WALLET.FROZEN.ge(opValue.negate()))) + .execute(); + if (result == 0) { + return false; + } + TMemberWalletRecord walletRecord = getWallet(walletId); + dslContext.insertInto(T_MEMBER_WALLET_LOG) + .set(T_MEMBER_WALLET_LOG.WALLET_ID, walletId) + .set(T_MEMBER_WALLET_LOG.MEMBER_ID, walletRecord.getMemberId()) + .set(T_MEMBER_WALLET_LOG.TYPE, 2) + .set(T_MEMBER_WALLET_LOG.COIN_ID, walletRecord.getCoinId()) + .set(T_MEMBER_WALLET_LOG.OP_VALUE, opValue) + .set(T_MEMBER_WALLET_LOG.OP_BEFORE, walletRecord.getFrozen().subtract(opValue)) + .set(T_MEMBER_WALLET_LOG.OP_AFTER, walletRecord.getFrozen()) + .set(T_MEMBER_WALLET_LOG.OP_TYPE, logType.getCode()) + .set(T_MEMBER_WALLET_LOG.OP_REMARK, logType.getRemark()) + .set(T_MEMBER_WALLET_LOG.EXT_REMARK, extRemark != null ? extRemark : "") + .execute(); + return true; + } + + public boolean batchOperate(List operations) { + return batchOperate(operations, true); + } + + public boolean batchOperate(List operations, boolean check) { + return batchOperate(operations, check, true); + } + + public boolean batchOperate(List operations, boolean check, boolean sort) { + if (sort) { + operations.sort(Comparator.comparingInt(WalletOperation::getWalletId)); + } + for (WalletOperation item : operations) { + boolean res = false; + switch (item.getType()) { + case 1: + res = operateBalance(item); + break; + case 2: + res = operateFrozen(item); + break; + default: + log.warn("bad wallet operate type"); + } + if (!res && check) { + log.error("批量操作失败"); + return false; + } + } + return true; + } + + public void verifyActivityStatisticsRecord(String account) { + Integer count = dslContext.selectCount().from(ACTIVITY_STATISTICS).where(ACTIVITY_STATISTICS.ADDRESS.eq(account)).fetchAnyInto(Integer.class); + if(count == null || count == 0){ + //实例化用户资产统计 + ActivityStatisticsRecord statisticsRecord = dslContext.newRecord(ACTIVITY_STATISTICS); + statisticsRecord.setAddress(account); + statisticsRecord.setAmount(BigDecimal.ZERO); + statisticsRecord.store(); + } + } +} diff --git a/alive-api/src/main/java/com/alive/server/task/ActivityTask.java b/alive-api/src/main/java/com/alive/server/task/ActivityTask.java new file mode 100644 index 0000000..e88f4cb --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/task/ActivityTask.java @@ -0,0 +1,64 @@ +package com.alive.server.task; + +import com.alive.server.service.TaskService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + + +/** + * 活动定时任务 + */ +@Slf4j +@Component +@Transactional(isolation = Isolation.READ_COMMITTED) +public class ActivityTask { + + @Autowired + private TaskService taskService; + + /** + * 5分钟执行一次 关注、改名 + */ + /*@Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void twitterOptimismExec() { + taskService.optimismExec(); + }*/ + + /** + * 5分钟执行一次 转载、点赞 + */ + /*@Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void twitterActiveExec() { + taskService.activeExec(); + }*/ + + /** + * 5分钟执行一次 加入Discord + */ + /*@Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void addDiscord() { + taskService.addDiscord(); + }*/ + + /** + * 5分钟执行一次 加入TG + */ + /*@Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void addTg() { + taskService.addTg(); + }*/ + + /** + * 10分钟执行一次 乐观验证任务 + */ + /*@Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void optimisticValidation() { + taskService.optimisticValidation(); + }*/ + +} + + diff --git a/alive-api/src/main/java/com/alive/server/task/CrowdfundingTask.java b/alive-api/src/main/java/com/alive/server/task/CrowdfundingTask.java new file mode 100644 index 0000000..d59412e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/task/CrowdfundingTask.java @@ -0,0 +1,46 @@ +package com.alive.server.task; + +import com.alive.server.service.CrowdfundingService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + + + +/** + * 众筹 + */ +@Slf4j +@Component +/*@Profile({"dev"})*/ +@Transactional(isolation = Isolation.READ_COMMITTED) +public class CrowdfundingTask { + + @Autowired + private CrowdfundingService crowdfundingService; + + /** + * 节点交易确认 10分钟执行一次 + */ + @Scheduled(initialDelay = 15_000, fixedDelay = 1000 * 60 * 10) + public void exec() { + crowdfundingService.exec(); + } + + /** + * 众筹监听 + * socket监听区块,socket同步日志,监听最新的数据 + * 10分钟重启一次,防止异常停止监听 + * @throws InterruptedException + */ + @Scheduled(initialDelay = 15 * 1000, fixedDelay = 10 * 1000) + public void bscScanTaskWithWs(){ + crowdfundingService.bscScanTask(); + } + +} + + diff --git a/alive-api/src/main/java/com/alive/server/task/TransferTask.java b/alive-api/src/main/java/com/alive/server/task/TransferTask.java new file mode 100644 index 0000000..69f6e59 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/task/TransferTask.java @@ -0,0 +1,31 @@ +package com.alive.server.task; + +import com.alive.server.service.OnChainTransfersService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + + +/** + * 活动定时任务 链上转账 + */ +@Slf4j +@Component +public class TransferTask { + + @Autowired + private OnChainTransfersService onChainTransfersService; + + /** + * 5分钟执行一次 链上转账 + */ + @Scheduled(initialDelay = 20_000, fixedDelay = 600_00 * 2) + public void exec() { + //onChainTransfersService.transfer(); + } + + +} + + diff --git a/alive-api/src/main/java/com/alive/server/task/WsBscScanTask.java b/alive-api/src/main/java/com/alive/server/task/WsBscScanTask.java new file mode 100644 index 0000000..7fa0e3e --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/task/WsBscScanTask.java @@ -0,0 +1,42 @@ +package com.alive.server.task; + +import com.alive.server.service.BscTimingService; +import com.alive.server.service.BtcBuyService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + + +/** + * @author HayDen + */ +@Slf4j +@Component +public class WsBscScanTask { + + @Autowired + private BscTimingService bscScanTask; + + @Autowired + private BtcBuyService btcBuyService; + + /** + * 节点交易确认 10分钟执行一次 + */ + @Scheduled(initialDelay = 15_000, fixedDelay = 1000 * 60 * 10) + public void btcTransactionConfirmation() { + //btcBuyService.exec(); + } + + /** + * socket监听区块,socket同步日志,监听最新的数据 + * 10分钟重启一次,防止异常停止监听 + * @throws InterruptedException + */ + @Scheduled(initialDelay = 15 * 1000, fixedDelay = 6 * 1000) + public void bscScanTaskWithWs(){ + //bscScanTask.bscScanTask(); + } + +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/task/WsCrossBridgesScanTask.java b/alive-api/src/main/java/com/alive/server/task/WsCrossBridgesScanTask.java new file mode 100644 index 0000000..ab49bd9 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/task/WsCrossBridgesScanTask.java @@ -0,0 +1,67 @@ +package com.alive.server.task; + +import com.alive.server.service.BscWsService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.http.HttpService; + +import java.util.Arrays; +import java.util.List; + + +/** + * @author HayDen + */ +@Slf4j +@Component +public class WsCrossBridgesScanTask { + + /** + * socket节点 + */ + @Value("${com.alive.roosChainWsUrl}") + private String roosChainWsUrl; + + /** + * 合约地址 + */ + @Value("${com.alive.roosContractUrl}") + private String roosContractUrl; + + @Autowired + private BscWsService bscWsService; + + public Web3j getCrossBridgesBscWsWeb3j() { + return Web3j.build(new HttpService(roosChainWsUrl)); + } + + /** + * 需要同步日志的合约 + * @return + */ + private List getAddresses() { + return Arrays.asList(roosContractUrl); + } + + /** + * 验证跨连桥任务数据 + * 10分钟重启一次,防止异常停止监听 + * @throws InterruptedException + */ + @Scheduled(initialDelay = 15 * 1000, fixedDelay = 60 * 1000 * 10) + public void crossBridgesBscScanTaskWithWs(){ + /* long threadId = Thread.currentThread().getId(); + log.info("enter {}", threadId); + EthFilter filter = new EthFilter( + DefaultBlockParameter.valueOf("latest"), + DefaultBlockParameter.valueOf("latest"), + this.getAddresses() + ); + Flowable flowable = this.getCrossBridgesBscWsWeb3j().ethLogFlowable(filter); + bscWsService.wsExec(flowable);*/ + } +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/web3/ContractEventHandle.java b/alive-api/src/main/java/com/alive/server/web3/ContractEventHandle.java new file mode 100644 index 0000000..0c691cc --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/web3/ContractEventHandle.java @@ -0,0 +1,10 @@ +package com.alive.server.web3; + +import org.web3j.protocol.core.methods.response.EthLog; + +import java.util.List; + +public interface ContractEventHandle { + + String handle(EthLog.LogObject logObject, List dataList); +} \ No newline at end of file diff --git a/alive-api/src/main/java/com/alive/server/web3/RLPEncryption.java b/alive-api/src/main/java/com/alive/server/web3/RLPEncryption.java new file mode 100644 index 0000000..21bb177 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/web3/RLPEncryption.java @@ -0,0 +1,43 @@ +package com.alive.server.web3; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Objects; + +public class RLPEncryption { + + private static final String AES_ALGORITHM = "AES"; + + public static byte[] encrypt(byte[] key, byte[] data) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(key, AES_ALGORITHM); + Cipher cipher = Cipher.getInstance(AES_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); + return cipher.doFinal(data); + } + + public static byte[] decrypt(byte[] key, byte[] encryptedData) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(key, AES_ALGORITHM); + Cipher cipher = Cipher.getInstance(AES_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); + return cipher.doFinal(encryptedData); + } + + public static SecretKey generateAESKey(int keySize) throws NoSuchAlgorithmException { + KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); + keyGenerator.init(keySize); + return keyGenerator.generateKey(); + } + + public static String bytesToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(String.format("%02X", b)); + } + return sb.toString(); + } + +} diff --git a/alive-api/src/main/java/com/alive/server/web3/RSAEncryption.java b/alive-api/src/main/java/com/alive/server/web3/RSAEncryption.java new file mode 100644 index 0000000..a11c18c --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/web3/RSAEncryption.java @@ -0,0 +1,34 @@ +package com.alive.server.web3; + +import java.security.*; +import javax.crypto.Cipher; + +public class RSAEncryption { + + public static void main(String[] args) throws Exception { + // 要加密的明文 + String plainText = "Hello, World!"; + + // 1. 生成 RSA 密钥对 + KeyPair keyPair = generateRSAKeyPair(); + PublicKey publicKey = keyPair.getPublic(); + + // 2. 使用 Solidity 合约提供的公钥加密数据 + byte[] encryptedData = encryptData(publicKey, plainText.getBytes()); + System.out.println("Encrypted data: " + new String(encryptedData)); + + // 将加密后的数据发送到 Solidity 合约 + } + + public static KeyPair generateRSAKeyPair() throws Exception { + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); + keyPairGenerator.initialize(2048); + return keyPairGenerator.generateKeyPair(); + } + + public static byte[] encryptData(PublicKey publicKey, byte[] data) throws Exception { + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + return cipher.doFinal(data); + } +} diff --git a/alive-api/src/main/java/com/alive/server/web3/Web3jServer.java b/alive-api/src/main/java/com/alive/server/web3/Web3jServer.java new file mode 100644 index 0000000..a496f05 --- /dev/null +++ b/alive-api/src/main/java/com/alive/server/web3/Web3jServer.java @@ -0,0 +1,193 @@ +package com.alive.server.web3; + +import com.alive.db.entity.Vo.PayCoinVo; +import com.alive.db.entity.Vo.TransactionDataVo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt; +import org.web3j.protocol.core.methods.response.Log; +import org.web3j.protocol.core.methods.response.TransactionReceipt; +import org.web3j.protocol.http.HttpService; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + + +@Slf4j +@Service +public class Web3jServer { + + /** + * 普通节点 + */ + @Value("${com.alive.chainUrl}") + private String chainUrl; + + + public Web3j getWeb3j(){ + return Web3j.build(new HttpService(chainUrl)); + } + + /** + * 通过hash获取交易的数据 + * @param hash + * @return + */ + public TransactionDataVo getEthLogsByHash(String hash) throws IOException { + TransactionDataVo vo = new TransactionDataVo(); + EthGetTransactionReceipt transaction = this.getWeb3j().ethGetTransactionReceipt(hash).send(); + TransactionReceipt transactionReceipt = transaction.getResult(); + if(transactionReceipt == null){ + return new TransactionDataVo().setStatus(-1); + } + //0=失败 1=成功 + String status = typeCast16By10(transactionReceipt.getStatus()); + vo.setStatus(Integer.parseInt(status)); + if(!status.equals("1")){ + return vo; + } + vo.setFrom(transactionReceipt.getFrom().toLowerCase()); + List log = transactionReceipt.getLogs(); + if(log == null || log.size() == 0){ + return null; + } + //交易数据 + Log payLogs = log.get(0); + vo.setPayAmount(new BigDecimal(typeCast16By10(payLogs.getData()))); + vo.setNftNumber(0); + vo.setNftIds(new ArrayList<>()); + Integer lenth = log.size(); + for (int i = 0; i < lenth; i++) { + List topics = log.get(i).getTopics(); + if(topics.size() != 4 && vo.getNftIds().size() > 0){ + break; + } + if(topics.size() == 4){ + vo.setNftNumber(vo.getNftNumber() + 1); + vo.getNftIds().add(Integer.parseInt(typeCast16By10(topics.get(3)))); + } + } + //取出上级地址 + payLogs = log.get(lenth - 2); + if(payLogs.getTopics().size() != 3){ + payLogs = log.get(lenth - 3); + } + if(payLogs.getTopics().size() != 3){ + //没有上级 + vo.setTeamAmount(BigDecimal.ZERO); + vo.setTeamAddress("0"); + }else{ + BigDecimal teamAmount = new BigDecimal(typeCast16By10(payLogs.getData())); + vo.setTeamAmount(teamAmount); + vo.setTeamAddress("0x"+payLogs.getTopics().get(2).substring(26,payLogs.getTopics().get(2).length())); + } + return vo; + } + + /** + * 通过hash获取交易的数据 + * @param hash + * @return + */ + public PayCoinVo crowdfundingByHash(String hash) throws IOException { + PayCoinVo vo = new PayCoinVo(); + vo.setUsdtAmount(BigDecimal.ZERO); + EthGetTransactionReceipt transaction = this.getWeb3j().ethGetTransactionReceipt(hash).send(); + TransactionReceipt transactionReceipt = transaction.getResult(); + if(transactionReceipt == null){ + return new PayCoinVo().setStatus(-1); + } + //0=失败 1=成功 + String status = typeCast16By10(transactionReceipt.getStatus()); + vo.setStatus(Integer.parseInt(status)); + if(!status.equals("1")){ + return vo; + } + vo.setAddress(transactionReceipt.getFrom().toLowerCase()); + List log = transactionReceipt.getLogs(); + if(log == null || log.size() == 0){ + return null; + } + //交易数据 + Log payLogs = log.get(0); + vo.setUsdtAmount(new BigDecimal(typeCast16By10(payLogs.getData()))); + payLogs = log.get(1); + Integer len = payLogs.getData().length(); + vo.setOrderNumber(getValue(payLogs.getData().substring(len-64,len),0,false)); + return vo; + } + + /** + * 查询日志里面加indexed的内容 + * @param value 转换的内容 + * @return 16进制转换成10进制 + */ + public static String typeCast16By10(String value){ + String ret = value.substring(2,value.length()); + if(StringUtils.isBlank(ret)){ + return "0"; + } + //16进制转10进制 + return new BigInteger(ret, 16).toString(); + } + + + /** + * 将ETH地址转换成uint160 + * @param ethAddress + * @return + */ + public static BigInteger addressToUint160(String ethAddress){ + // 将地址转换为 BigInteger + BigInteger addressAsBigInt = new BigInteger(ethAddress.substring(2), 16); + // Solidity 中的 uint160 最大值 + BigInteger uint160MaxValue = new BigInteger("ffffffffffffffffffffffffffffffffffffffff", 16); + // 取地址的低 160 位作为 Solidity 中的 uint160 + BigInteger uint160Address = addressAsBigInt.and(uint160MaxValue); + return uint160Address; + } + + /** + * 查询日志里面加indexed的内容 + * @param topList 日志内容 + * @param code 查询第几个 + * @return + */ + public static BigInteger getNmber(List topList, Integer code){ + String ret = topList.get(code); + ret = ret.substring(2,ret.length()); + //16进制转10进制 + return new BigInteger(ret, 16); + } + + /** + * 获取没有加indexed的内容 + * @param date 拆分的参数 + * @param code 取的位数 + * @param address 是否返回地址 + * @return + */ + public static String getValue(String date, Integer code, Boolean address){ + int number = 64; + if(code == 0){ + date = date.substring(0,number); + }else{ + code = number * code; + date = date.substring(code,code+number); + } + if(address){ + return "0x"+date.substring(24,date.length()); + }else{ + return new BigInteger(date, 16).toString(); + } + + } + +} + \ No newline at end of file diff --git a/alive-api/src/main/resources/config/application-dev.yml b/alive-api/src/main/resources/config/application-dev.yml new file mode 100644 index 0000000..191ad0a --- /dev/null +++ b/alive-api/src/main/resources/config/application-dev.yml @@ -0,0 +1,44 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/alive_dev?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true + username: root + password: root + + redis: + host: 127.0.0.1 + database: 2 + password: + lettuce: + pool: + max-active: 20 + max-idle: 16 + max-wait: 1000ms + min-idle: 10 + +com.alive: + #ARB节点服务器 + chainUrl: 'https://go.getblock.io/7a508279a1a84ba6832cbc53f27e571a/' + #ARBsocket节点服务器 + chainWsUrl: 'https://go.getblock.io/7a508279a1a84ba6832cbc53f27e571a/' + contractUrl: '0x9B20e2e0b114D50B3a8328e7Ca8C1303aFDC13A4' + + + #任务测试跨连桥合约监听器 + roosChainWsUrl: 'https://go.getblock.io/8181dc29e53a4ea4948e30c61e3e0aeb/' + roosContractUrl: '0xeeEC77da95C788b58595Fcd7eBad1d87Ae821aCE' + common: + auth: + jwtSecret: 'inode-dev' + task: + enable: true + bot: true + cron: + sampleCronTask: '0 */10 * * * ?' # 示例cron任务 + +#链上转账配置 +chain: + transfer: + rpcUrl: 'https://testrpc.roospro.com' + erc20: '0x204074AD198E7c6e79E195DAf576bc7D53967B45' + privateKey: 'd94f3dc1629be0bb718ad9bb55d09d57de1667258101565f58d99018bdfba029' \ No newline at end of file diff --git a/alive-api/src/main/resources/config/application-prod.yml b/alive-api/src/main/resources/config/application-prod.yml new file mode 100644 index 0000000..454f429 --- /dev/null +++ b/alive-api/src/main/resources/config/application-prod.yml @@ -0,0 +1,44 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/alive_prod?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true + username: alive_prod + password: 6jD2S3CGwGYhRXNp + + redis: + host: 127.0.0.1 + database: 7 + password: + lettuce: + pool: + max-active: 20 + max-idle: 16 + max-wait: 1000ms + min-idle: 10 + +com.alive: + #ARB节点服务器 + chainUrl: 'https://go.getblock.io/e3842ff6182b4907ac9863503e77744e/' + #ARBsocket节点服务器 + chainWsUrl: 'https://go.getblock.io/e3842ff6182b4907ac9863503e77744e/' + contractUrl: '0x92B64f3BCf327ada976Fa876c7F17b177f333Eea' + + + #任务测试跨连桥合约监听器 暂时没有用到 + roosChainWsUrl: 'https://go.getblock.io/8181dc29e53a4ea4948e30c61e3e0aeb/' + roosContractUrl: '0xeeEC77da95C788b58595Fcd7eBad1d87Ae821aCE' + common: + auth: + jwtSecret: 'inode-dev' + task: + enable: true + bot: true + cron: + sampleCronTask: '0 */10 * * * ?' # 示例cron任务 + +#链上转账配置 +chain: + transfer: + rpcUrl: 'https://testrpc.roospro.com' + erc20: '0x204074AD198E7c6e79E195DAf576bc7D53967B45' + privateKey: 'd94f3dc1629be0bb718ad9bb55d09d57de1667258101565f58d99018bdfba029' \ No newline at end of file diff --git a/alive-api/src/main/resources/config/application-test.yml b/alive-api/src/main/resources/config/application-test.yml new file mode 100644 index 0000000..0f49c50 --- /dev/null +++ b/alive-api/src/main/resources/config/application-test.yml @@ -0,0 +1,44 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/alive_test?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true + username: alive_test + password: cf2xrRTPHL875NRA + + redis: + host: 127.0.0.1 + database: 2 + password: + lettuce: + pool: + max-active: 20 + max-idle: 16 + max-wait: 1000ms + min-idle: 10 + +com.alive: + #ARB节点服务器 + chainUrl: 'https://go.getblock.io/7a508279a1a84ba6832cbc53f27e571a/' + #ARBsocket节点服务器 + chainWsUrl: 'https://go.getblock.io/7a508279a1a84ba6832cbc53f27e571a/' + contractUrl: '0x9B20e2e0b114D50B3a8328e7Ca8C1303aFDC13A4' + + + #任务测试跨连桥合约监听器 + roosChainWsUrl: 'https://go.getblock.io/8181dc29e53a4ea4948e30c61e3e0aeb/' + roosContractUrl: '0xeeEC77da95C788b58595Fcd7eBad1d87Ae821aCE' + common: + auth: + jwtSecret: 'inode-dev' + task: + enable: true + bot: true + cron: + sampleCronTask: '0 */10 * * * ?' # 示例cron任务 + +#链上转账配置 +chain: + transfer: + rpcUrl: 'https://testrpc.roospro.com' + erc20: '0x204074AD198E7c6e79E195DAf576bc7D53967B45' + privateKey: 'd94f3dc1629be0bb718ad9bb55d09d57de1667258101565f58d99018bdfba029' \ No newline at end of file diff --git a/alive-api/src/main/resources/config/application.yml b/alive-api/src/main/resources/config/application.yml new file mode 100644 index 0000000..dc3b856 --- /dev/null +++ b/alive-api/src/main/resources/config/application.yml @@ -0,0 +1,45 @@ +server: + port: 8181 + shutdown: graceful + servlet: + encoding: + force: true + charset: UTF-8 + +spring: + profiles: + active: prod + application: + name: inode-api + jackson: + serialization: # 返回时间戳 + write-dates-as-timestamps: true + servlet: + multipart: + max-file-size: 50MB + max-request-size: 50MB + +logging: + level: + root: warn + com.alive: info + +com.alive: + upload: + filePath: '/data/upload' + defaultUrlPreFix: 'http://file.alive.com/upload/' + + config: + tokenHeader: 'Authorization' + tokenRedisKeyFormat: 'smt:token:%d:%s' + tokenExpireSeconds: 25920000 + limitLoginOneOnly: false + +file-provider: + ribbon: + listOfServers: http://adjjw.jiujiwang.com.cn/ + ConnectTimeout: 6000 + ReadTimeout: 6000 + + + diff --git a/alive-api/src/main/resources/i18n/messages.properties b/alive-api/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..970453c --- /dev/null +++ b/alive-api/src/main/resources/i18n/messages.properties @@ -0,0 +1,36 @@ +ResultCodeEnum.0 = Request Successful +ResultCodeEnum.400 = Request Failed +ResultCodeEnum.401 = Login Required +ResultCodeEnum.402 = Access Denied +ResultCodeEnum.500 = Network Exception + +WalletLogTypeEnum.0 = System Operation +WalletLogTypeEnum.1 = System Recharge +WalletLogTypeEnum.2 = System Deduction +WalletLogTypeEnum.3 = Registration Gift +WalletLogTypeEnum.4 = Withdrawal +WalletLogTypeEnum.5 = Withdrawal Fee +WalletLogTypeEnum.6 = Withdrawal Rejected +WalletLogTypeEnum.7 = Transferred to {0} +WalletLogTypeEnum.8 = Transferred from {0} +WalletLogTypeEnum.9 = Exchanged Out +WalletLogTypeEnum.10 = Exchanged In +WalletLogTypeEnum.11 = Purchase Goods +WalletLogTypeEnum.12 = Shopping Gift +WalletLogTypeEnum.13 = Shopping Reward +WalletLogTypeEnum.14 = Sign In +WalletLogTypeEnum.15 = Sign In Reward +WalletLogTypeEnum.16 = Daily Release +WalletLogTypeEnum.17 = Team Reward +WalletLogTypeEnum.18 = Cancel Order +WalletLogTypeEnum.19 = Lucky Draw +WalletLogTypeEnum.20 = Accelerated Release +WalletLogTypeEnum.21 = Transfer Out +WalletLogTypeEnum.22 = Transfer In +WalletLogTypeEnum.23 = Static Release +WalletLogTypeEnum.24 = Accelerated Release +WalletLogTypeEnum.25 = Reservation of Equity Token +WalletLogTypeEnum.26 = Pre-purchase Success +WalletLogTypeEnum.27 = Pre-purchase Refund +WalletLogTypeEnum.28 = Participate in Sale +WalletLogTypeEnum.29 = Startup Investment Thaw \ No newline at end of file diff --git a/alive-commons/pom.xml b/alive-commons/pom.xml new file mode 100644 index 0000000..bdf83fe --- /dev/null +++ b/alive-commons/pom.xml @@ -0,0 +1,211 @@ + + + + com.alive + alive-api-server + 1.0-SNAPSHOT + + + 4.0.0 + alive-commons + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.springframework.boot + spring-boot-starter-cache + + + + com.baomidou + mybatis-plus-boot-starter + 3.3.2 + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-jooq + + + + + org.springframework.cloud + spring-cloud-starter-feign + 1.4.7.RELEASE + + + org.springframework.cloud + spring-cloud-starter-netflix-ribbon + 2.2.3.RELEASE + + + io.github.openfeign.form + feign-form + 3.8.0 + + + io.github.openfeign.form + feign-form-spring + 3.8.0 + + + + + io.springfox + springfox-swagger2 + 2.7.0 + + + + com.github.xiaoymin + swagger-bootstrap-ui + 1.9.6 + + + + org.projectlombok + lombok + true + + + + commons-lang + commons-lang + 2.6 + + + + org.apache.commons + commons-lang3 + 3.8.1 + + + + commons-codec + commons-codec + 1.11 + + + + org.apache.commons + commons-pool2 + 2.7.0 + + + + commons-beanutils + commons-beanutils + 1.9.4 + + + + com.sun.mail + javax.mail + 1.5.6 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.7 + + + + com.google.code.gson + gson + 2.8.5 + + + + com.alibaba + fastjson + 1.2.70 + + + + com.squareup.okhttp3 + okhttp + 3.8.1 + compile + + + + com.squareup.okhttp3 + logging-interceptor + 3.8.1 + compile + + + + junit + junit + 4.12 + test + + + + org.web3j + core + 3.4.0 + + + + org.hibernate + hibernate-validator + 6.0.18.Final + + + + + org.apache.poi + poi + 3.13 + + + + org.apache.poi + poi-ooxml + 3.13 + + + + joda-time + joda-time + + + + com.auth0 + java-jwt + 3.3.0 + + + + com.aliyun + dysmsapi20170525 + 2.0.22 + + + + \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/SpringContextHolder.java b/alive-commons/src/main/java/com/alive/commons/SpringContextHolder.java new file mode 100644 index 0000000..792ce82 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/SpringContextHolder.java @@ -0,0 +1,64 @@ +package com.alive.commons; + +import org.springframework.beans.factory.DisposableBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +@Component +@Lazy(false) +public class SpringContextHolder implements ApplicationContextAware, DisposableBean { + + private static ApplicationContext applicationContext = null; + + + /** + * 取得存储在静态变量中的ApplicationContext. + */ + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) { + return (T) applicationContext.getBean(name); + } + + /** + * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型. + */ + public static T getBean(Class requiredType) { + return applicationContext.getBean(requiredType); + } + + public static T getBean(String name, Class clazz) { + return getApplicationContext().getBean(name, clazz); + } + + /** + * 清除SpringContextHolder中的ApplicationContext为Null. + */ + public static void clearHolder() { + applicationContext = null; + } + + /** + * 实现ApplicationContextAware接口, 注入Context到静态变量中. + */ + @Override + public void setApplicationContext(ApplicationContext appContext) { + applicationContext = appContext; + } + + /** + * 实现DisposableBean接口, 在Context关闭时清理静态变量. + */ + @Override + public void destroy() { + SpringContextHolder.clearHolder(); + } +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/annotation/BusinessLog.java b/alive-commons/src/main/java/com/alive/commons/annotation/BusinessLog.java new file mode 100644 index 0000000..c8906d3 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/annotation/BusinessLog.java @@ -0,0 +1,15 @@ +package com.alive.commons.annotation; + +import java.lang.annotation.*; + +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BusinessLog { + /** + * 业务的名称,例如:"修改菜单" + */ + String value() default ""; + + boolean skipLogParam() default false; +} diff --git a/alive-commons/src/main/java/com/alive/commons/annotation/Login.java b/alive-commons/src/main/java/com/alive/commons/annotation/Login.java new file mode 100644 index 0000000..a9912a4 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/annotation/Login.java @@ -0,0 +1,18 @@ +package com.alive.commons.annotation; + +import java.lang.annotation.*; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Login { + + //该接口是否加密 + boolean encrypted() default false; + + //AES解密密钥,在encrypted为true时有效,若不指定,则从当前token中获取 + String key() default ""; + + //权限 + String[] permits() default {}; +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/ApplicationStopListener.java b/alive-commons/src/main/java/com/alive/commons/config/ApplicationStopListener.java new file mode 100644 index 0000000..9684cf2 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/ApplicationStopListener.java @@ -0,0 +1,53 @@ +package com.alive.commons.config; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.event.ContextClosedEvent; + +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +@Slf4j +@Configuration +public class ApplicationStopListener implements ApplicationListener { + + @Autowired(required = false) + private ThreadPoolExecutor taskExecutor; + + @Override + public void onApplicationEvent(ContextClosedEvent event) { + log.warn("Application will exit"); + shutdownTaskExecutor(); + log.warn("Application exited, will not accept requests."); + } + + private void shutdownTaskExecutor() { + if (taskExecutor == null) { + log.info("No task executor"); + return; + } + taskExecutor.shutdown(); + log.warn("Wait TaskExecutor shutdown"); + int retry = 0; + try { + while (!taskExecutor.awaitTermination(2000, TimeUnit.MILLISECONDS)) { + log.warn("taskExecutor.activeCount: {}", taskExecutor.getActiveCount()); + if (taskExecutor.getActiveCount() == 0 || retry >= 6) { + taskExecutor.shutdownNow(); + log.warn("TaskExecutor shutdown now force exit, retried: {}, active: {}", retry, taskExecutor.getActiveCount()); + break; + } + if (retry++ >= 3) { + taskExecutor.shutdownNow(); + log.warn("Retry {} times, TaskExecutor shutdown now", retry); + } + } + } catch (InterruptedException e) { + log.error("TaskExecutor shutdown interrupted"); + log.error(e.getMessage()); + } + log.warn("TaskExecutor shutdown finish"); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/BaseComponent.java b/alive-commons/src/main/java/com/alive/commons/config/BaseComponent.java new file mode 100644 index 0000000..0ad91ab --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/BaseComponent.java @@ -0,0 +1,22 @@ +package com.alive.commons.config; + +import lombok.extern.slf4j.Slf4j; +import org.jooq.DSLContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +@Slf4j +@Transactional(isolation = Isolation.READ_COMMITTED) +public class BaseComponent { + + @Autowired + protected DSLContext dslContext; + + @Value("${spring.profiles.active}") + protected String env; + + protected final static byte ONE = 1; + protected final static byte ZERO = 0; + +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/CommonProperties.java b/alive-commons/src/main/java/com/alive/commons/config/CommonProperties.java new file mode 100644 index 0000000..201cf1e --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/CommonProperties.java @@ -0,0 +1,40 @@ +package com.alive.commons.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "com.alive.common", ignoreUnknownFields = true) +public class CommonProperties { + + private Async async = new Async(); + + private Auth auth = new Auth(); + + private Upload upload = new Upload(); + + @Data + public static class Async { + private int corePoolSize = 10; + private int maxPoolSize = 40; + private int queueCapacity = 20; + private int keepAliveSeconds = 30; + } + + @Data + public static class Auth { + private String tokenHeader = "Authorization"; + private String passwordKey = "gxfc2022"; + private String jwtSecret = "odc2022"; + private Long tokenExpireSeconds = 86400L; + } + + @Data + public static class Upload { + private String filePath; + private String fileUrlPrefix; + } + +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/Constants.java b/alive-commons/src/main/java/com/alive/commons/config/Constants.java new file mode 100644 index 0000000..0b00854 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/Constants.java @@ -0,0 +1,115 @@ +package com.alive.commons.config; + +/** + * 通用常量信息 + * + * @author ruoyi + */ +public class Constants +{ + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * GBK 字符集 + */ + public static final String GBK = "GBK"; + + /** + * http请求 + */ + public static final String HTTP = "http://"; + + /** + * https请求 + */ + public static final String HTTPS = "https://"; + + /** + * 通用成功标识 + */ + public static final String SUCCESS = "0"; + + /** + * 通用失败标识 + */ + public static final String FAIL = "1"; + + /** + * 登录成功 + */ + public static final String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + public static final String LOGOUT = "Logout"; + + /** + * 注册 + */ + public static final String REGISTER = "Register"; + + /** + * 登录失败 + */ + public static final String LOGIN_FAIL = "Error"; + + /** + * 系统用户授权缓存 + */ + public static final String SYS_AUTH_CACHE = "sys-authCache"; + + /** + * 参数管理 cache name + */ + public static final String SYS_CONFIG_CACHE = "sys-config"; + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 字典管理 cache name + */ + public static final String SYS_DICT_CACHE = "sys-dict"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; + + /** + * RMI 远程方法调用 + */ + public static final String LOOKUP_RMI = "rmi:"; + + /** + * LDAP 远程方法调用 + */ + public static final String LOOKUP_LDAP = "ldap:"; + + /** + * LDAPS 远程方法调用 + */ + public static final String LOOKUP_LDAPS = "ldaps:"; + + /** + * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) + */ + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; + + /** + * 定时任务违规的字符 + */ + public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", + "org.springframework", "org.apache", "com.ruoyi.common.utils.file" }; +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/config/MyBatisConfig.java b/alive-commons/src/main/java/com/alive/commons/config/MyBatisConfig.java new file mode 100644 index 0000000..c357a0b --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/MyBatisConfig.java @@ -0,0 +1,33 @@ +package com.alive.commons.config; + +import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@MapperScan({"com.alive"}) +@EnableTransactionManagement +public class MyBatisConfig { + + @Bean + public PaginationInterceptor paginationInterceptor() { + PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); + + // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false + paginationInterceptor.setOverflow(false); + // 设置最大单页限制数量,默认 500 条,-1 不受限制 + paginationInterceptor.setLimit(Integer.MAX_VALUE); + // 开启 count 的 join 优化,只针对部分 left join + paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true)); + return paginationInterceptor; + } + + @Bean + public OptimisticLockerInterceptor optimisticLockerInterceptor() { + return new OptimisticLockerInterceptor(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/RestTemplateConfig.java b/alive-commons/src/main/java/com/alive/commons/config/RestTemplateConfig.java new file mode 100644 index 0000000..856f92e --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/RestTemplateConfig.java @@ -0,0 +1,28 @@ +package com.alive.commons.config; + +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import java.util.Arrays; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { + MappingJackson2HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter(); + jacksonConverter.setSupportedMediaTypes( + Arrays.asList( + MediaType.APPLICATION_JSON, + MediaType.TEXT_HTML + )); + + RestTemplate restTemplate = restTemplateBuilder.build(); + restTemplate.getMessageConverters().add(jacksonConverter); + return restTemplate; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/config/TaskConfig.java b/alive-commons/src/main/java/com/alive/commons/config/TaskConfig.java new file mode 100644 index 0000000..9913dc3 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/config/TaskConfig.java @@ -0,0 +1,36 @@ +package com.alive.commons.config; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + +@Slf4j +@Configuration +@EnableScheduling +@ConditionalOnProperty(value = "com.alive.task.enable", havingValue = "true") +public class TaskConfig implements SchedulingConfigurer { + + @Override + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { + scheduledTaskRegistrar.setScheduler(taskExecutor()); + } + + @Bean + public ThreadPoolExecutor taskExecutor() { + log.info("new ScheduledThreadPoolExecutor"); + return new ScheduledThreadPoolExecutor(8) { + @Override + protected void terminated() { + super.terminated(); + log.warn("Task Executor terminated"); + } + }; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/enums/BaseEnum.java b/alive-commons/src/main/java/com/alive/commons/enums/BaseEnum.java new file mode 100644 index 0000000..3870b81 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/enums/BaseEnum.java @@ -0,0 +1,23 @@ +package com.alive.commons.enums; + +import com.alive.commons.model.EnumModel; + +/** + * 需要国际化的枚举类实现该接口 + */ +public interface BaseEnum { + + int getEnumCode(); + + default String label() { + return null; + } + + default String i18nKey() { + return null; + } + + default EnumModel toModel() { + return new EnumModel(getEnumCode() + "", label()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/enums/BaseResultCodeEnum.java b/alive-commons/src/main/java/com/alive/commons/enums/BaseResultCodeEnum.java new file mode 100644 index 0000000..cbeb362 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/enums/BaseResultCodeEnum.java @@ -0,0 +1,38 @@ +package com.alive.commons.enums; + +public enum BaseResultCodeEnum implements BaseEnum { + + SUCCESS(0, "success"), + BAD_REQUEST(400, "bad request"), + UN_AUTHORIZATION(401, "un auth"), + FORBIDDEN(402, "forbidden"), + SERVER_EXCEPTION(500, "server exception"), + + ; + + private final int code; + private final String remark; + + BaseResultCodeEnum(int code, String remark) { + this.code = code; + this.remark = remark; + } + + public int getCode() { + return code; + } + + public String getRemark() { + return remark; + } + + @Override + public int getEnumCode() { + return this.code; + } + + @Override + public String i18nKey() { + return "ResultCodeEnum." + this.code; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/enums/LanguageEnum.java b/alive-commons/src/main/java/com/alive/commons/enums/LanguageEnum.java new file mode 100644 index 0000000..43910ca --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/enums/LanguageEnum.java @@ -0,0 +1,44 @@ +package com.alive.commons.enums; + +public enum LanguageEnum implements BaseEnum { + + zh_CN(0, "zh-CN"), + zh_TW(1, "zh-TW"), + en(2, "en"), + ; + private final int code; + private final String remark; + + LanguageEnum(int code, String remark) { + this.code = code; + this.remark = remark; + } + + public int getCode() { + return code; + } + + public String getRemark() { + return remark; + } + + @Override + public int getEnumCode() { + return this.code; + } + + @Override + public String i18nKey() { + return "LanguageEnum." + getCode(); + } + + + public static LanguageEnum valueOf(int enumCode) { + for (LanguageEnum typeEnum : LanguageEnum.values()) { + if (typeEnum.getEnumCode() == enumCode) { + return typeEnum; + } + } + return null; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/enums/WalletLogTypeEnum.java b/alive-commons/src/main/java/com/alive/commons/enums/WalletLogTypeEnum.java new file mode 100644 index 0000000..c2884e8 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/enums/WalletLogTypeEnum.java @@ -0,0 +1,71 @@ +package com.alive.commons.enums; + +public enum WalletLogTypeEnum implements BaseEnum { + + DEFAULT(0, "系统操作"), + ADMIN_ADD(1, "系统充值"), + ADMIN_SUB(2, "系统扣除"), + RECHARGE(3, "链上充值"), + RBIT_IS_COMPLIMENTARY_ON_ORDERS(4, "下单赠送RBIT"), + ORDER_FREE_NFT(5, "下单赠送NFT"), + ONE_RBIT_REWARD(6, "1代Rbit奖励"), + + ONE_NFT_REWARD(7, "1代NFT奖励"), + + TWO_RBIT_REWARD(8, "2代Rbit奖励"), + + TWO_NFT_REWARD(9, "2代NFT奖励"), + + TASK_REWARD(10, "领取任务积分"), + + RECOMMENDER_ASSIGNMENT_REWARD(11, "下级任务奖励积分"), + + SUBCOMMISSION(12, "下级返佣"), + + REBATE_TO_ACCOUNT(13, "返佣到账扣除"), + + PRIVATE_PLACEMENT(14, "私募"), + + AIRDROP(15, "空投"), + ; + + private final int code; + private final String remark; + + WalletLogTypeEnum(int code, String remark) { + this.code = code; + this.remark = remark; + } + + public int getCode() { + return code; + } + + public String getRemark() { + return remark; + } + + @Override + public int getEnumCode() { + return this.code; + } + + @Override + public String i18nKey() { + return "WalletLogTypeEnum." + getCode(); + } + + @Override + public String label() { + return getRemark(); + } + + public static WalletLogTypeEnum valueOf(int enumCode) { + for (WalletLogTypeEnum typeEnum : WalletLogTypeEnum.values()) { + if (typeEnum.getEnumCode() == enumCode) { + return typeEnum; + } + } + return WalletLogTypeEnum.DEFAULT; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/excel/ExcelUtil.java b/alive-commons/src/main/java/com/alive/commons/excel/ExcelUtil.java new file mode 100644 index 0000000..a969caf --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/excel/ExcelUtil.java @@ -0,0 +1,406 @@ +package com.alive.commons.excel; + + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.*; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Created by axboy on 14/12/11. + */ +public class ExcelUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtil.class); + + public static String[][] getExcelData(InputStream is, int ignoreRows) throws IOException, InvalidFormatException { + List result = new ArrayList(); + /* 1.初始化WorkBook*/ + Workbook workbook = WorkbookFactory.create(is); + /* 得到sheet的个数 */ + int sheetNum = 1; + int cellSize = 0; + /*2.遍历sheet*/ + for (int i = 0; i < sheetNum; i++) { + Sheet sheet = workbook.getSheetAt(i); + for (int rowIndex = ignoreRows; rowIndex <= sheet.getLastRowNum(); rowIndex++) { + /* 3.得到Sheet中的row*/ + Row row = sheet.getRow(rowIndex); + if (row == null) { + continue; + } + // TODO 不太明白这里为什么要设置为Excel文档实际的单元格个数加1 + int tempCellSize = row.getLastCellNum() + 1; + if (tempCellSize > cellSize) { + cellSize = tempCellSize; + } + + String[] cellValues = new String[cellSize]; + Arrays.fill(cellValues, ""); + /* 3.解析Row内容*/ + boolean hasValue = false; + for (int columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) { + String cellValue = null; + Cell cell = row.getCell(columnIndex); + if (cell != null) { + cellValue = getCellValue(cell); + } + /* 去除前后空格 */ + + if (cellValue != null) { + cellValue = cellValue.trim(); + } + + cellValues[columnIndex] = cellValue; + hasValue = true; + } + + if (hasValue) { + result.add(cellValues); + } + + } + } + String[][] returnArray = new String[result.size()][cellSize]; + for (int i = 0; i < returnArray.length; i++) { + returnArray[i] = result.get(i); + } + return returnArray; + } + + + public static void createExcel(List data, String exportType, HttpServletResponse response) throws Exception { + if (data == null) { + data = Collections.emptyList(); + } + final String pattern = "yyyyMMdd-HHmmss"; + DateTime dateTime = new DateTime(System.currentTimeMillis(), DateTimeZone.forID("+08:00")); + + String fileName = new String(String.format("%s-%s.xlsx", exportType, dateTime.toString(pattern)).getBytes(), "ISO8859-1"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + createExcel(data, response.getOutputStream()); + response.getOutputStream().flush(); + response.getOutputStream().close(); + } + + /** + * 生成Excel + */ + private static void createExcel(List data, OutputStream outputStream) throws Exception { + createExcel(data, "+08:00", outputStream); + } + + /** + * 重载方法,增加时区 + */ + private static void createExcel(List data, String timeZone, OutputStream outputStream) throws Exception { + if (data.isEmpty()) { + return; + } + XSSFWorkbook workbook = new XSSFWorkbook(); + XSSFSheet sheet = workbook.createSheet(); + workbook.setSheetName(0, "sheet1"); + List fieldNames = new ArrayList<>(); + + final Field[] declaredFields = data.get(0).getClass().getDeclaredFields(); + final XSSFCellStyle defaultStyle = createDefaultDataStyle(workbook); + + int j = 0; + for (Field declaredField : declaredFields) { + final ExportField annotation = declaredField.getAnnotation(ExportField.class); + if (annotation == null) { + continue; + } + fieldNames.add(annotation.name()); + + XSSFCell cell = getCell(sheet, 0, j); + cell.setCellValue(annotation.name()); + cell.setCellStyle(defaultStyle); + + int colWidth = Integer.max(annotation.width(), fieldNames.get(j).length()); + if (annotation.type() == ExportType.DATE) { + colWidth = annotation.timeFormat().length() / 2; + } + + double t = (colWidth * 2 + 2) * 256; + if (t > 255 * 256) { + t = 20 * 256; + } + sheet.setColumnWidth(j, (int) t); + j++; + } + + for (int row = 0; row < data.size(); row++) { + final Object bean = data.get(row); + + int col = 0; + + for (int fieldCol = 0; fieldCol < declaredFields.length; fieldCol++) { + final Field declaredField = declaredFields[fieldCol]; + final ExportField[] annotation = declaredField.getAnnotationsByType(ExportField.class); + if (annotation == null || annotation.length == 0) { + continue; + } + String property = ""; + XSSFCell cell = getCell(sheet, row + 1, col++); + switch (annotation[0].type()) { + case DATE: + String format = annotation[0].timeFormat(); + if (format.equals("")) { + format = "yyyy-MM-dd HH:mm:ss"; + } + final CellStyle dateStyle = getCellDateStyle(workbook, format); + //fix : null point ex + if (PropertyUtils.getProperty(bean, declaredField.getName()) == null) { + cell.setCellStyle(dateStyle); + break; + } + Long timeMills = null; + if (declaredField.getType().equals(Timestamp.class)) { + Timestamp obj = (Timestamp) PropertyUtils.getProperty(bean, declaredField.getName()); + timeMills = obj.getTime(); + } + if (declaredField.getType().equals(Date.class)) { + Date obj = (Date) PropertyUtils.getProperty(bean, declaredField.getName()); + timeMills = obj.getTime(); + } + if (declaredField.getType().equals(DateTime.class)) { + DateTime obj = (DateTime) PropertyUtils.getProperty(bean, declaredField.getName()); + timeMills = obj.getMillis(); + } + if (declaredField.getType().equals(Long.class)) { + Long obj = (Long) PropertyUtils.getProperty(bean, declaredField.getName()); + timeMills = obj; + } + if (declaredField.getType().equals(Integer.class)) { + Integer obj = (Integer) PropertyUtils.getProperty(bean, declaredField.getName()); + timeMills = obj.longValue() * 1000; + } + final String pattern = annotation[0].timeFormat(); + DateTime dateTime = new DateTime(timeMills, DateTimeZone.forID(timeZone)); + DateTime dateTime1 = DateTime.parse(dateTime.toString(pattern), DateTimeFormat.forPattern(pattern)); + cell.setCellStyle(dateStyle); + cell.setCellValue(dateTime1.toDate()); + break; + case NUMBER: + Number number = (Number) PropertyUtils.getProperty(bean, declaredField.getName()); + if (number == null) { + break; + } + double v = 0; + if (number != null) { + v = NumberUtils.toDouble(number.toString()); + } + cell.setCellValue(v); + cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellStyle(defaultStyle); + break; + default: + cell.setCellStyle(defaultStyle); + String name = declaredField.getName(); + if (name.equals("pId")) { + name = "PId"; + } + if (name.equals("pMobile")) { + name = "PMobile"; + } + property = BeanUtils.getProperty(bean, name); + cell.setCellValue(property); + break; + } + } + } + + //设置行高 + sheet.setDefaultRowHeightInPoints(15); + // 冻结第一行 + sheet.createFreezePane(0, 1); + workbook.write(outputStream); + workbook.close(); + } + + public static String getCellValue(Cell cell) { + String cellValue = null; + int cellType = cell.getCellType(); + switch (cellType) { + case Cell.CELL_TYPE_STRING: // 字符串型 + cellValue = cell.getRichStringCellValue().getString(); + break; + case Cell.CELL_TYPE_NUMERIC: // 数值型 (纯数字类型如果 cell.getNumericCellValue(),读取的类型是double,需要做特殊的处理) + if (DateUtil.isCellDateFormatted(cell)) { // 时间类型 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = cell.getDateCellValue(); + if (date != null) { + cellValue = String.valueOf(dateFormat.format(date)); + } + } else { + // 小数点后面是否只包含0,如果是则化整,不是则默认 + cell.setCellType(Cell.CELL_TYPE_STRING); + String temp = cell.getRichStringCellValue().getString(); + if (temp.contains(".")) { + String temp1 = temp.substring(temp.indexOf(".") + 1, temp.length()); + if (!temp1.isEmpty()) { + if (temp1.matches("0+$")) { + cellValue = temp.substring(0, temp.indexOf(".")); + } else { + cellValue = temp; + } + } + } else { + cellValue = temp; + } + } + break; + case Cell.CELL_TYPE_FORMULA: + String temp = cell.getCellFormula(); + if (null != temp) { + cellValue = temp.replaceAll("#N/A", "").trim(); + } + break; + case Cell.CELL_TYPE_ERROR: // 故障 + cellValue = null; + break; + case Cell.CELL_TYPE_BOOLEAN: + cellValue = Boolean.toString(cell.getBooleanCellValue()); + break; + case Cell.CELL_TYPE_BLANK: // 空值 + cellValue = null; + break; + default: + cellValue = ""; + } + return cellValue; + } + + + private static CellStyle getCellDateStyle(XSSFWorkbook workbook, String pattern) { + + XSSFDataFormat format = workbook.createDataFormat(); + + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框 + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); //左边框 + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); //右边框 + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框 + cellStyle.setDataFormat(format.getFormat(pattern)); + + cellStyle.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER); + return cellStyle; + } + + //自定义的方法,插入某个图片到指定索引的位置 + private static void insertImage(XSSFWorkbook wb, XSSFDrawing pa, byte[] data, int row, int column) { + XSSFClientAnchor anchor = new XSSFClientAnchor(); + anchor.setCol1(column); + anchor.setCol2(column + 1); + anchor.setRow1(row); + anchor.setRow2(row + 1); + anchor.setAnchorType(2); + pa.createPicture(anchor, wb.addPicture(data, XSSFWorkbook.PICTURE_TYPE_JPEG)); + } + + //从图片里面得到字节数组 + private static byte[] getImageData(BufferedImage bi) { + try { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + ImageIO.write(bi, "JPG", bout); + return bout.toByteArray(); + } catch (Exception exe) { + LOGGER.error("IO Exception", exe); + return null; + } + } + + + /** + * Convenient method to obtain the cell in the given sheet, row and column.

Creates the row and the cell if they + * still doesn't already exist. Thus, the column can be passed as an int, the method making the needed downcasts. + * + * @param sheet a sheet object. The first sheet is usually obtained by workbook.getSheetAt(0) + * @param row thr row number + * @param col the column number + * @return the HSSFCell + */ + private static XSSFCell getCell(XSSFSheet sheet, int row, int col) { + XSSFRow sheetRow = sheet.getRow(row); + if (sheetRow == null) { + sheetRow = sheet.createRow(row); + } + XSSFCell cell = sheetRow.getCell(col); + if (cell == null) { + cell = sheetRow.createCell(col); + } + return cell; + } + + /** + * 设置缺省标题样式 + */ + private static XSSFCellStyle getTitleStyle(XSSFWorkbook workbook) { + XSSFCellStyle style = workbook.createCellStyle(); + style.setFillForegroundColor(HSSFColor.WHITE.index); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setAlignment(HSSFCellStyle.ALIGN_CENTER); + style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框 + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //左边框 + style.setBorderRight(HSSFCellStyle.BORDER_THIN); //右边框 + style.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框 + style.setLeftBorderColor(HSSFColor.BLACK.index); + style.setRightBorderColor(HSSFColor.BLACK.index); + style.setTopBorderColor(HSSFColor.BLACK.index); + style.setBottomBorderColor(HSSFColor.BLACK.index); + + //设置单元格字体显示颜色 + XSSFFont font = workbook.createFont();//创建一个Font + font.setFontName("黑体"); + font.setFontHeightInPoints((short) 14); + font.setColor(HSSFColor.BLACK.index); + style.setFont(font); + return style; + } + + /** + * 设置缺省普通单元格样式 + */ + private static XSSFCellStyle createDefaultDataStyle(XSSFWorkbook workbook) { + XSSFCellStyle style = workbook.createCellStyle(); + style.setFillForegroundColor(HSSFColor.WHITE.index); + style.setAlignment(HSSFCellStyle.ALIGN_CENTER); + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框 + style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //左边框 + style.setBorderRight(HSSFCellStyle.BORDER_THIN); //右边框 + style.setBorderTop(HSSFCellStyle.BORDER_THIN); //上边框 + //style.setWrapText(true); + //设置单元格字体显示颜色 + XSSFFont font = workbook.createFont();//创建一个Font + font.setFontName("宋体"); + font.setFontHeightInPoints((short) 10); + font.setColor(HSSFColor.BLACK.index); + style.setFont(font); + return style; + } +} + diff --git a/alive-commons/src/main/java/com/alive/commons/excel/ExportField.java b/alive-commons/src/main/java/com/alive/commons/excel/ExportField.java new file mode 100644 index 0000000..c17f230 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/excel/ExportField.java @@ -0,0 +1,22 @@ +package com.alive.commons.excel; + +import java.lang.annotation.*; + +@Documented +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExportField { + /*表头显示名称*/ + String name(); + + /*导出数据的类型*/ + ExportType type() default ExportType.STRING; + + /*导出数据的格式*/ + String timeFormat() default "yyyy-MM-dd HH:mm:ss"; + + String stringFormat() default ""; + + //默认列宽 + int width() default 5; +} diff --git a/alive-commons/src/main/java/com/alive/commons/excel/ExportModel.java b/alive-commons/src/main/java/com/alive/commons/excel/ExportModel.java new file mode 100644 index 0000000..93af194 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/excel/ExportModel.java @@ -0,0 +1,14 @@ +package com.alive.commons.excel; + +import java.util.Collections; +import java.util.Map; + +public interface ExportModel { + default String getSheetName() { + return "sheet1"; + } + + default Map getExtAttr() { + return Collections.emptyMap(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/excel/ExportType.java b/alive-commons/src/main/java/com/alive/commons/excel/ExportType.java new file mode 100644 index 0000000..6b830ac --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/excel/ExportType.java @@ -0,0 +1,10 @@ +package com.alive.commons.excel; + +public enum ExportType { + /*日期类型*/ + DATE, + /*字符串*/ + STRING, + /*数字*/ + NUMBER +} diff --git a/alive-commons/src/main/java/com/alive/commons/exception/DcException.java b/alive-commons/src/main/java/com/alive/commons/exception/DcException.java new file mode 100644 index 0000000..3e18a01 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/exception/DcException.java @@ -0,0 +1,39 @@ +package com.alive.commons.exception; + +import com.alive.commons.enums.BaseEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Map; + +@Data +@EqualsAndHashCode(callSuper = true) +public class DcException extends RuntimeException { + + private int code; + + private BaseEnum resultCodeEnum; + + private Map otherInfo; + + public DcException(BaseEnum codeEnum) { + super(codeEnum.i18nKey()); + resultCodeEnum = codeEnum; + code = codeEnum.getEnumCode(); + } + + public DcException(BaseEnum codeEnum, Map otherInfo) { + super(codeEnum.i18nKey()); + resultCodeEnum = codeEnum; + this.code = codeEnum.getEnumCode(); + this.otherInfo = otherInfo; + } + + public int getCode() { + return code; + } + + public BaseEnum getResultCodeEnum() { + return resultCodeEnum; + } +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/exception/ErrorHandler.java b/alive-commons/src/main/java/com/alive/commons/exception/ErrorHandler.java new file mode 100644 index 0000000..2262e1f --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/exception/ErrorHandler.java @@ -0,0 +1,87 @@ +package com.alive.commons.exception; + +import com.alive.commons.model.BaseResult; +import com.alive.commons.util.MessageUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import springfox.documentation.annotations.ApiIgnore; + +@Slf4j +@ControllerAdvice +@ApiIgnore +public class ErrorHandler { + + @ResponseBody + @ExceptionHandler(Exception.class) + public ResponseEntity> handleException(Exception e) { + log.error(">>> Exception 请处理: {}", e.getLocalizedMessage()); + e.printStackTrace(); + BaseResult result = new BaseResult<>(500, "SERVER EXCEPTION", null); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @ResponseBody + @ExceptionHandler(RuntimeException.class) + public ResponseEntity> handleRuntimeException(RuntimeException e) { + log.error(">>> RuntimeException: {}", e.getLocalizedMessage()); + StackTraceElement[] stackTraceElements = e.getStackTrace(); + for (StackTraceElement stackTraceElement : stackTraceElements) { + if (stackTraceElement.getClassName().startsWith("com.alive") && stackTraceElement.getLineNumber() > 0) { + log.error("错误位置在:{}.{}(), {}行", + stackTraceElement.getClassName(), + stackTraceElement.getMethodName(), + stackTraceElement.getLineNumber()); + } + } + String msg = e.getLocalizedMessage(); + if (msg != null && msg.length() > 50) { + msg = msg.substring(0, 50); + } + BaseResult result = new BaseResult<>(500, msg, null); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @ResponseBody + @ExceptionHandler(IllegalArgumentException.class) + public ResponseEntity> handleException(IllegalArgumentException e) { + log.error(">>> IllegalArgumentException: {}", e.getLocalizedMessage()); + // e.printStackTrace(); + BaseResult result = new BaseResult<>(400, e.getMessage(), null); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @ResponseBody + @ExceptionHandler(HttpMessageNotReadableException.class) + public ResponseEntity> handleException(HttpMessageNotReadableException e) { + log.error(">>> HttpMessageNotReadableException: {}", e.getLocalizedMessage()); + // e.printStackTrace(); + BaseResult result = new BaseResult<>(400, "Invalid Params", null); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @ResponseBody + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity> handleException(MethodArgumentNotValidException e) { + log.error(">>> MethodArgumentNotValidException: {}", e.getLocalizedMessage()); + //e.printStackTrace(); + BaseResult result = new BaseResult<>(400, e.getBindingResult().getAllErrors().get(0).getDefaultMessage(), null); + return new ResponseEntity<>(result, HttpStatus.OK); + } + + @ResponseBody + @ExceptionHandler(DcException.class) + public ResponseEntity> handleException(DcException e) { + log.error(">>> DcException: {}", e.getLocalizedMessage()); + //e.printStackTrace(); + + String message = MessageUtil.get(e.getResultCodeEnum().i18nKey()); + BaseResult result = new BaseResult<>(e.getCode(), message, null); + return new ResponseEntity<>(result, HttpStatus.OK); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/AppPageReq.java b/alive-commons/src/main/java/com/alive/commons/model/AppPageReq.java new file mode 100644 index 0000000..2e7617d --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/AppPageReq.java @@ -0,0 +1,22 @@ +package com.alive.commons.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AppPageReq { + + @ApiModelProperty("上次最后一条数据的id,若没有传-1,默认-1") + private Integer last = -1; + + @ApiModelProperty("分页大小,默认100,最大500") + private Integer size = 100; + + public Integer getLast() { + return last == null || last == -1 ? Integer.MAX_VALUE : last; + } + + public Integer getSize() { + return size == null || size > 500 ? 500 : size; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/AppPageResp.java b/alive-commons/src/main/java/com/alive/commons/model/AppPageResp.java new file mode 100644 index 0000000..3b9c43f --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/AppPageResp.java @@ -0,0 +1,18 @@ +package com.alive.commons.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public abstract class AppPageResp { + + @ApiModelProperty("最后1条数据的id,用于请求下1页数据,若为0,则是最后1页") + protected Integer last; + + @ApiModelProperty("分页数据,空数组表示最后一页") + protected List list; + + public abstract void fix(); +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/BasePageReq.java b/alive-commons/src/main/java/com/alive/commons/model/BasePageReq.java new file mode 100644 index 0000000..18828a3 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/BasePageReq.java @@ -0,0 +1,53 @@ +package com.alive.commons.model; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class BasePageReq { + + @ApiModelProperty("分页页码,从1开始") + private Integer page = 1; + + @ApiModelProperty("分页大小,默认20,最大500") + private Integer size = 20; + + //获取page对象,用于mybatis-plus,返回分页大小 + @JsonIgnore + public IPage getIPage() { + if (page == null) { + page = 1; + } + if (size == null) { + size = 20; + } + return new Page<>(page, size).setSearchCount(true); + } + + @JsonIgnore + public IPage getIPageForExport() { + return new Page<>(1, Integer.MAX_VALUE).setSearchCount(false); + } + + //获取offset,用于手动处理sql + @JsonIgnore + public int getOffset() { + if (page == null) { + page = 1; + } + if (size == null) { + size = 20; + } + return page > 1 ? page * size - size : 0; + } + + public int getSize() { + if (size == null || size <= 0 || size > 500) { + return 20; + } + return size; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/BasePageResp.java b/alive-commons/src/main/java/com/alive/commons/model/BasePageResp.java new file mode 100644 index 0000000..a4f349c --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/BasePageResp.java @@ -0,0 +1,21 @@ +package com.alive.commons.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class BasePageResp { + + private Integer total; + + private List list; + + public BasePageResp(Integer total, List list) { + this.total = total; + this.list = list; + } + + public BasePageResp() { + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/BaseResult.java b/alive-commons/src/main/java/com/alive/commons/model/BaseResult.java new file mode 100644 index 0000000..4c2fafd --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/BaseResult.java @@ -0,0 +1,46 @@ +package com.alive.commons.model; + +import lombok.Data; + +@Data +public class BaseResult { + private int code = 0; + private String msg = "Success"; + private long timeMillis = System.currentTimeMillis(); + private T data; + + public BaseResult() { + } + + public BaseResult(T data) { + this.data = data; + } + + public BaseResult(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public BaseResult(int code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + public static BaseResult success(String msg) { + return new BaseResult<>(0, msg); + } + + public static BaseResult success() { + return new BaseResult<>(0, "Success"); + } + + public static BaseResult error(String msg) { + return new BaseResult<>(400, msg); + } + + public static BaseResult error() { + return new BaseResult<>(400, "Failed"); + } + +} diff --git a/alive-commons/src/main/java/com/alive/commons/model/BaseSummaryPageResp.java b/alive-commons/src/main/java/com/alive/commons/model/BaseSummaryPageResp.java new file mode 100644 index 0000000..9519e0c --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/BaseSummaryPageResp.java @@ -0,0 +1,18 @@ +package com.alive.commons.model; + +import lombok.Data; + +import java.util.Collections; + +@Data +public class BaseSummaryPageResp extends BasePageResp { + + private T summary; + + public static BaseSummaryPageResp emptyResult() { + BaseSummaryPageResp resp = new BaseSummaryPageResp<>(); + resp.setTotal(0); + resp.setList(Collections.emptyList()); + return resp; + } +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/model/EnumModel.java b/alive-commons/src/main/java/com/alive/commons/model/EnumModel.java new file mode 100644 index 0000000..3e20f11 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/model/EnumModel.java @@ -0,0 +1,19 @@ +package com.alive.commons.model; + +import lombok.Data; + +@Data +public class EnumModel { + + private String key; + + private String label; + + public EnumModel() { + } + + public EnumModel(String key, String label) { + this.key = key; + this.label = label; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/page/PageService.java b/alive-commons/src/main/java/com/alive/commons/page/PageService.java new file mode 100644 index 0000000..10a2b6e --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/page/PageService.java @@ -0,0 +1,43 @@ +package com.alive.commons.page; + +import com.alive.commons.model.BasePageReq; +import com.alive.commons.model.BasePageResp; +import com.alive.commons.util.RedisUtil; +import com.alive.commons.util.Md5Util; +import org.jooq.DSLContext; +import org.jooq.SelectLimitStep; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; + +/** + * @author zcw + * @version 1.0.0 + * @date 2018/06/19 16:44 + * 分页工具 + */ +@Service +public class PageService { + + @Autowired + private DSLContext dslContext; + + @SuppressWarnings("unchecked") + public BasePageResp getPageData(SelectLimitStep sql, BasePageReq pageReq, Class responseType) { + String cacheKey = "PageServiceCount:" + Md5Util.md5(sql.getSQL(true).toLowerCase()); + String cacheRes = RedisUtil.get(cacheKey); + + int fetchCount = cacheRes == null ? dslContext.fetchCount(sql) : Integer.parseInt(cacheRes); + if (cacheRes == null && fetchCount > 10_0000) { + RedisUtil.setEx(cacheKey, fetchCount + "", 30); + } + + if (fetchCount == 0) { + return new BasePageResp<>(0, Collections.emptyList()); + } + List list = sql.limit(pageReq.getOffset(), pageReq.getSize()).fetchInto(responseType); + return new BasePageResp<>(fetchCount, list); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/redis/MyCacheKeyGenerator.java b/alive-commons/src/main/java/com/alive/commons/redis/MyCacheKeyGenerator.java new file mode 100644 index 0000000..4f64e1e --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/redis/MyCacheKeyGenerator.java @@ -0,0 +1,26 @@ +package com.alive.commons.redis; + +import com.alive.commons.util.Md5Util; +import org.springframework.cache.interceptor.KeyGenerator; + +import java.lang.reflect.Method; + +/** + * 缓存key自定义生成规则, + */ +public class MyCacheKeyGenerator implements KeyGenerator { + + @Override + public Object generate(Object target, Method method, Object... params) { + String className = target.getClass().getName(); + String methodName = method.getName(); + StringBuilder builder = new StringBuilder(); + + if (params.length > 0) { + for (int i = 0; i < params.length; i++) { + builder.append(params[i] != null ? params[i] : "NULL").append("&"); + } + } + return String.format("%s:%s:%s", className, methodName, Md5Util.md5(builder.toString())); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/redis/MyCacheManager.java b/alive-commons/src/main/java/com/alive/commons/redis/MyCacheManager.java new file mode 100644 index 0000000..2e16ef6 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/redis/MyCacheManager.java @@ -0,0 +1,32 @@ +package com.alive.commons.redis; + +import org.springframework.data.redis.cache.RedisCache; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; + +import java.time.Duration; + +/** + * 自定义缓存配置 + */ +public class MyCacheManager extends RedisCacheManager { + + //缓存key与过期时间分隔符 + private static final String SEPARATOR = "#"; + + public MyCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) { + super(cacheWriter, defaultCacheConfiguration); + } + + @Override + protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) { + String[] values = name.split(SEPARATOR); + if (values.length > 1) { + long second = Long.parseLong(values[1]); + cacheConfig = cacheConfig.entryTtl(Duration.ofSeconds(second)); + } + + return super.createRedisCache(name, cacheConfig); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/redis/RedisConfig.java b/alive-commons/src/main/java/com/alive/commons/redis/RedisConfig.java new file mode 100644 index 0000000..c6824fd --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/redis/RedisConfig.java @@ -0,0 +1,41 @@ +package com.alive.commons.redis; + +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheWriter; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; + +import java.time.Duration; + +@EnableCaching +@Configuration +public class RedisConfig { + + //默认过期时间,10s + private static final int EXPIRATION_SECOND = 10; + public static final String KEY_GENERATOR_NAME = "MyKeyGenerator"; + public static final String CACHE_KEY = "Cache"; + + @Bean + public MyCacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory) { + RedisSerializationContext.SerializationPair valuePair = + RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()); + + RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory); + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() + .entryTtl(Duration.ofSeconds(EXPIRATION_SECOND)) + .serializeValuesWith(valuePair) + .disableCachingNullValues(); + return new MyCacheManager(redisCacheWriter, config); + } + + @Bean(value = KEY_GENERATOR_NAME) + public KeyGenerator keyGenerator() { + return new MyCacheKeyGenerator(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/AddressSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/AddressSerializer.java new file mode 100644 index 0000000..db5df43 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/AddressSerializer.java @@ -0,0 +1,23 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class AddressSerializer extends JsonSerializer { + @Override + public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeNumber("0x00****0000"); + return; + } + if (value.length() < 20) { + jsonGenerator.writeString(value); + return; + } + //(\\d{4})\\d{10}(\\w{4}) + jsonGenerator.writeString(value.replaceAll("(\\w{4})\\w{34}(\\w{4})", "$1****$2")); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/BaseEnumI18nSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/BaseEnumI18nSerializer.java new file mode 100644 index 0000000..91a1355 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/BaseEnumI18nSerializer.java @@ -0,0 +1,22 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.alive.commons.enums.BaseEnum; +import com.alive.commons.util.MessageUtil; + +import java.io.IOException; + +public class BaseEnumI18nSerializer extends JsonSerializer { + + @Override + public void serialize(BaseEnum baseEnum, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (baseEnum == null) { + jsonGenerator.writeNull(); + return; + } + String i18nMsg = MessageUtil.get(baseEnum.i18nKey()); + jsonGenerator.writeString(i18nMsg); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/BigCnySerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/BigCnySerializer.java new file mode 100644 index 0000000..c4f4509 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/BigCnySerializer.java @@ -0,0 +1,32 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class BigCnySerializer extends JsonSerializer { + + private static final BigDecimal WAN = new BigDecimal("10000"); + private static final BigDecimal MILLION = new BigDecimal("1000000"); + + @Override + public void serialize(BigDecimal bigDecimal, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (bigDecimal == null) { + jsonGenerator.writeString("0"); + return; + } + if (bigDecimal.compareTo(MILLION) >= 0) { + jsonGenerator.writeString(bigDecimal.divide(WAN, 0, RoundingMode.DOWN).stripTrailingZeros().toPlainString() + "万"); + return; + } + if(bigDecimal.compareTo(WAN) >= 0){ + jsonGenerator.writeString(bigDecimal.setScale(0, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + return; + } + jsonGenerator.writeString(bigDecimal.setScale(2, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/BigIntegerSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/BigIntegerSerializer.java new file mode 100644 index 0000000..058e5c9 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/BigIntegerSerializer.java @@ -0,0 +1,19 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigInteger; + +public class BigIntegerSerializer extends JsonSerializer { + @Override + public void serialize(BigInteger value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeNumber("0"); + return; + } + jsonGenerator.writeString(value.toString()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/CnySerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/CnySerializer.java new file mode 100644 index 0000000..c20bffe --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/CnySerializer.java @@ -0,0 +1,20 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class CnySerializer extends JsonSerializer { + @Override + public void serialize(BigDecimal bigDecimal, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (bigDecimal == null) { + jsonGenerator.writeNumber(0); + return; + } + jsonGenerator.writeString(bigDecimal.setScale(6, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/CoinNumSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/CoinNumSerializer.java new file mode 100644 index 0000000..9c3c9c0 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/CoinNumSerializer.java @@ -0,0 +1,37 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class CoinNumSerializer extends JsonSerializer { + + private static final BigDecimal MILLION = new BigDecimal("1000000"); + private static final BigDecimal THOUSAND = new BigDecimal("1000"); + private static final BigDecimal SCALE6 = new BigDecimal("0.000001"); + private static final BigDecimal SCALE3 = new BigDecimal("0.001"); + + @Override + public void serialize(BigDecimal value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeNumber("0"); + return; + } + BigDecimal abs = value.abs(); + if (abs.compareTo(MILLION) >= 0) { + jsonGenerator.writeString(value.setScale(0, RoundingMode.DOWN).toPlainString()); + } else if (abs.compareTo(THOUSAND) >= 0) { + jsonGenerator.writeString(value.setScale(2, RoundingMode.DOWN).toPlainString()); + } else if (abs.compareTo(SCALE6) < 0) { + jsonGenerator.writeString(value.setScale(8, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } else if (abs.compareTo(SCALE3) < 0) { + jsonGenerator.writeString(value.setScale(6, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } else { + jsonGenerator.writeString(value.setScale(4, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/DistanceSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/DistanceSerializer.java new file mode 100644 index 0000000..64d5a00 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/DistanceSerializer.java @@ -0,0 +1,24 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 经纬度数字序列化,保留6位小数 + */ +public class DistanceSerializer extends JsonSerializer { + + @Override + public void serialize(Double value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeString("0"); + return; + } + jsonGenerator.writeString(BigDecimal.valueOf(value).setScale(2, RoundingMode.DOWN).stripTrailingZeros().toPlainString()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/LongNumberSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/LongNumberSerializer.java new file mode 100644 index 0000000..cc188f8 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/LongNumberSerializer.java @@ -0,0 +1,18 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class LongNumberSerializer extends JsonSerializer { + @Override + public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeNumber("0"); + return; + } + jsonGenerator.writeString(value.toString()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/MobileSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/MobileSerializer.java new file mode 100644 index 0000000..c94bd2d --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/MobileSerializer.java @@ -0,0 +1,23 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class MobileSerializer extends JsonSerializer { + @Override + public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (value == null) { + jsonGenerator.writeNumber("000****0000"); + return; + } + if (value.length() < 11) { + jsonGenerator.writeString(value); + return; + } + //(\\d{3})\\d{4}(\\w{4}) + jsonGenerator.writeString(value.replaceAll("(\\w{3})\\w{4}(\\w{4})", "$1****$2")); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/serializer/PercentageSerializer.java b/alive-commons/src/main/java/com/alive/commons/serializer/PercentageSerializer.java new file mode 100644 index 0000000..4c80a2d --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/serializer/PercentageSerializer.java @@ -0,0 +1,26 @@ +package com.alive.commons.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 百分数序列化,乘以100 后追加百分号 + */ +public class PercentageSerializer extends JsonSerializer { + @Override + public void serialize(BigDecimal bigDecimal, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (bigDecimal == null) { + jsonGenerator.writeNumber("0.00 %"); + return; + } + jsonGenerator.writeString( + bigDecimal.multiply(BigDecimal.TEN.pow(2)) + .setScale(2, RoundingMode.DOWN).toPlainString() + " %" + ); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/Aes256Utils.java b/alive-commons/src/main/java/com/alive/commons/util/Aes256Utils.java new file mode 100644 index 0000000..c128dee --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/Aes256Utils.java @@ -0,0 +1,106 @@ +package com.alive.commons.util; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.security.SecureRandom; + +public class Aes256Utils { + + public static String seedValue = "0123456789abcdef0123456789abcdefddehs"; + + /** + * AES加密 + */ + public static String encrypt(String seed, String cleartext) throws Exception { + byte[] rawKey = getRawKey(seed.getBytes()); + byte[] result = encrypt(rawKey, cleartext.getBytes()); + return toHex(result); + } + + /** + * AES解密 + */ + public static String decrypt(String seed, String encrypted) throws Exception { + byte[] rawKey = getRawKey(seed.getBytes()); + byte[] enc = toByte(encrypted); + byte[] result = decrypt(rawKey, enc); + return new String(result); + } + + private static byte[] getRawKey(byte[] seed) throws Exception { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); + sr.setSeed(seed); + kgen.init(256, sr); // 192 and 256 bits may not be available + SecretKey skey = kgen.generateKey(); + byte[] raw = skey.getEncoded(); + return raw; + } + + + private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.ENCRYPT_MODE, skeySpec); + byte[] encrypted = cipher.doFinal(clear); + return encrypted; + } + + private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.DECRYPT_MODE, skeySpec); + byte[] decrypted = cipher.doFinal(encrypted); + return decrypted; + } + + public static String toHex(String txt) { + return toHex(txt.getBytes()); + } + + public static String fromHex(String hex) { + return new String(toByte(hex)); + } + + public static byte[] toByte(String hexString) { + int len = hexString.length() / 2; + byte[] result = new byte[len]; + for (int i = 0; i < len; i++) + result[i] = Integer.valueOf(hexString.substring(2 * i, 2 * i + 2), 16).byteValue(); + return result; + } + + public static String toHex(byte[] buf) { + if (buf == null) + return ""; + StringBuffer result = new StringBuffer(2 * buf.length); + for (int i = 0; i < buf.length; i++) { + appendHex(result, buf[i]); + } + return result.toString(); + } + + private final static String HEX = "0123456789ABCDEF"; + + private static void appendHex(StringBuffer sb, byte b) { + sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f)); + } + + + /* public static void main(String[] args) { + String content = "659C09DE"; + String password = "0123456789ABCDEF0123456789ABCDEF"; + System.out.println("明文:" + content); + System.out.println("key:" + password); + try { + String encryptResult = Aes256Utils.encrypt(password, content); + System.out.println("密文:" + encryptResult); + String decryptResult = decrypt(password, encryptResult); + System.out.println("解密:" + decryptResult); + } catch (Exception e) { + e.printStackTrace(); + } + }*/ +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/util/AesUtil.java b/alive-commons/src/main/java/com/alive/commons/util/AesUtil.java new file mode 100644 index 0000000..3d6f131 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/AesUtil.java @@ -0,0 +1,148 @@ +package com.alive.commons.util; + +import javax.crypto.*; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +/** + * AES对称加解密工具。 + * + * @author denvie + * @date 2019/11/25 + * @since 1.0.0 + */ +public class AesUtil { + + /** + * 解密 + */ + public static String decryptHexString(String hexContent, String password) { + return new String(decrypt(parseHexStr2Byte(hexContent), password)); + } + + /** + * 加密 + */ + public static String encryptToHexString(String content, String password) { + return parseByte2HexStr(encrypt(content, password)); + } + + + /** + * 加密 + * + * @param content 需要加密的内容 + * @param password 加密密码 + * @return + */ + private static byte[] encrypt(String content, String password) { + try { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + Cipher cipher = Cipher.getInstance("AES");// 创建密码器 + byte[] byteContent = content.getBytes("utf-8"); + cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化 + byte[] result = cipher.doFinal(byteContent); + return result; // 加密 + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 解密 + * + * @param content 待解密内容 + * @param password 解密密钥 + * @return + */ + private static byte[] decrypt(byte[] content, String password) { + if (content == null) { + return null; + } + try { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes()); + kgen.init(128, secureRandom); + + SecretKey secretKey = kgen.generateKey(); + byte[] enCodeFormat = secretKey.getEncoded(); + SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); + Cipher cipher = Cipher.getInstance("AES");// 创建密码器 + cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 + byte[] result = cipher.doFinal(content); + return result; // 加密 + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 将二进制转换成16进制 + * + * @param buf + * @return + */ + private static String parseByte2HexStr(byte buf[]) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < buf.length; i++) { + String hex = Integer.toHexString(buf[i] & 0xFF); + if (hex.length() == 1) { + hex = '0' + hex; + } + sb.append(hex.toUpperCase()); + } + return sb.toString(); + } + + /** + * 将16进制转换为二进制 + * + * @param hexStr + * @return + */ + private static byte[] parseHexStr2Byte(String hexStr) { + if (hexStr.length() < 1) + return null; + byte[] result = new byte[hexStr.length() / 2]; + for (int i = 0; i < hexStr.length() / 2; i++) { + int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); + int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); + result[i] = (byte) (high * 16 + low); + } + return result; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/AssertUtil.java b/alive-commons/src/main/java/com/alive/commons/util/AssertUtil.java new file mode 100644 index 0000000..3be3883 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/AssertUtil.java @@ -0,0 +1,19 @@ +package com.alive.commons.util; + +import com.alive.commons.enums.BaseEnum; +import com.alive.commons.exception.DcException; + +public class AssertUtil { + + public static void notNull(Object expression, BaseEnum message) { + if (expression == null) { + throw new DcException(message); + } + } + + public static void isTrue(boolean expression, BaseEnum message) { + if (!expression) { + throw new DcException(message); + } + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/CoinUtil.java b/alive-commons/src/main/java/com/alive/commons/util/CoinUtil.java new file mode 100644 index 0000000..907e8d5 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/CoinUtil.java @@ -0,0 +1,39 @@ +package com.alive.commons.util; + + +import java.util.HashMap; +import java.util.Map; + +/** + * 币种工具类 + */ +public class CoinUtil { + + public static Map coinMap = new HashMap<>(); + + + public static Map getCoinMap(){ + if(coinMap.size() == 0){ + //USDT + coinMap.put("USDT",1); + //RBIT + coinMap.put("RBIT",2); + //NFT配件 + coinMap.put("NFTCHIP",3); + //积分 + coinMap.put("POINTS",4); + } + return coinMap; + } + + + public static String getCoinName(Integer coinId){ + Map map = getCoinMap(); + for (Map.Entry obj : map.entrySet()){ + if(obj.getValue().equals(coinId)){ + return obj.getKey(); + } + } + return null; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/DateUtils.java b/alive-commons/src/main/java/com/alive/commons/util/DateUtils.java new file mode 100644 index 0000000..bdf33b0 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/DateUtils.java @@ -0,0 +1,445 @@ +package com.alive.commons.util; + +import org.apache.commons.lang3.time.DateFormatUtils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * 时间工具类 + * + * @author HayDen + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils +{ + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + public static SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); + public static SimpleDateFormat format1 = new SimpleDateFormat( + "yyyyMMdd HH:mm:ss"); + + /** + * 获取今天开始时间 + */ + public static String getStartTime() { + Date date = new Date(); + Calendar dateStart = Calendar.getInstance(); + dateStart.setTime(date); + dateStart.set(Calendar.HOUR_OF_DAY, 0); + dateStart.set(Calendar.MINUTE, 0); + dateStart.set(Calendar.SECOND, 0); + return dateByString(dateStart.getTime()); + } + + /** + * 字符串转Date + * @param date1 + * @return + */ + public static Date stringByDate(String date1){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);//注意月份是MM + Date date = null; + try { + date = simpleDateFormat.parse(date1); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * 获取今天结束时间 + */ + public static String getEndTime() { + Date date = new Date(); + Calendar dateEnd = Calendar.getInstance(); + dateEnd.setTime(date); + dateEnd.set(Calendar.HOUR_OF_DAY, 23); + dateEnd.set(Calendar.MINUTE, 59); + dateEnd.set(Calendar.SECOND, 59); + return dateByString(dateEnd.getTime()); + } + + /** + * 在基础时间上加或者减一天 + * + * @param date 当前时间 + * @param day 正数为加负数为减 + * @return + */ + public static Date getNextDay(Date date, Integer day) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_MONTH, day);//+1今天的时间加一天 + date = calendar.getTime(); + return date; + } + + /** + * 得到指定日期的一天的的最后时刻23:59:59 + * + * @param date + * @return + */ + public static Date getFinallyDate(Date date) { + String temp = format.format(date); + temp += " 23:59:59"; + + try { + return format1.parse(temp); + } catch (Exception e) { + return null; + } + } + + /** + * 给指定时间加上秒 + * @param date + * @return + */ + public static Date timePastTenSecond(Date date,Integer ss) { + try { + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + Calendar newTime = Calendar.getInstance(); + newTime.setTime(date); + newTime.add(Calendar.SECOND,ss);//日期加10秒 + + Date dt1=newTime.getTime(); + return dt1; + } + catch(Exception ex) { + ex.printStackTrace(); + return null; + } + } + + /** + * 得到指定日期的一天的开始时刻00:00:00 + * + * @param date + * @return + */ + public static Date getStartDate(Date date) { + String temp = format.format(date); + temp += " 00:00:00"; + + try { + return format1.parse(temp); + } catch (Exception e) { + return null; + } + } + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() { + return new Date(); + } + + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() + { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() + { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() + { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) + { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) + { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) + { + return new SimpleDateFormat(format).format(date); + } + + /** + * 将日期格式化 + * + * @param date + * @return + */ + public static String dateByString(Date date) { + if (date != null) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String tablename = dateFormat.format(date); + return tablename; + } + return null; + } + + public static String dateToHhMmSs(Date date) { + if (date != null) { + SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); + String tablename = dateFormat.format(date); + return tablename; + } + return null; + } + + + public static final Date dateTime(final String format, final String ts) { + try { + return new SimpleDateFormat(format).parse(ts); + } + catch (ParseException e) + { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) + { + if (str == null) + { + return null; + } + try + { + return parseDate(str.toString(), parsePatterns); + } + catch (ParseException e) + { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() + { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算相差天数 + */ + public static int differentDaysByMillisecond(Date date1, Date date2) + { + return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) + { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 字符串转换成日期 + * + * @param str + * @return date + */ + public static Date StrToDate(String str) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = null; + try { + date = format.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * 字符串转换成日期 + * + * @param str + * @return date + */ + public static Date StrToHhMmSs(String str) { + SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); + Date date = null; + try { + date = format.parse(str); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * 判断当前时间是否在[startTime, endTime]区间,注意时间格式要一致 + * + * @param nowTime 当前时间 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + * @author jqlin + */ + public static boolean isEffectiveDate(Date nowTime, Date startTime, Date endTime) { + if (nowTime.getTime() == startTime.getTime() + || nowTime.getTime() == endTime.getTime()) { + return true; + } + + Calendar date = Calendar.getInstance(); + date.setTime(nowTime); + + Calendar begin = Calendar.getInstance(); + begin.setTime(startTime); + + Calendar end = Calendar.getInstance(); + end.setTime(endTime); + + if (date.after(begin) && date.before(end)) { + return true; + } else { + return false; + } + } + + /** + * 判断时间是否在时间段内 + * + * @param nowTime + * @param beginTime + * @param endTime + * @return + */ + public static boolean belongCalendar(Date nowTime, Date beginTime, + Date endTime) { + Calendar date = Calendar.getInstance(); + date.setTime(nowTime); + + Calendar begin = Calendar.getInstance(); + begin.setTime(beginTime); + + Calendar end = Calendar.getInstance(); + end.setTime(endTime); + + if (date.after(begin) && date.before(end)) { + return true; + } else { + return false; + } + } + + /** + * 给指定的日期加上分钟后得到一个时间 + * @param date + * @param minute 要加的分钟数 + * @return + */ + public static Date addMinute(Date date,Integer minute) { + Calendar c = Calendar.getInstance(); + c.setTime(date); //设置时间 + c.add(Calendar.MINUTE, minute); //日期分钟加1,Calendar.DATE(天),Calendar.HOUR(小时) + date = c.getTime(); //结果 + return date; + } + + /** + * 根据两个时间判断当前时间是否在两个时间范围内 + * @param begin + * @param end + * @return + */ + public Boolean ifDateInner(Date begin,Date end){ + SimpleDateFormat df = new SimpleDateFormat("HH:mm");// 设置日期格式 + Date now = null; + Date beginTime = null; + Date endTime = null; + try { + now = df.parse(df.format(new Date())); + beginTime = df.parse(dateToHhMmSs(begin)); + endTime = df.parse(dateToHhMmSs(end)); + } catch (Exception e) { + e.printStackTrace(); + } + return belongCalendar(now, beginTime, endTime); + } + private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + public static String addDay(String date, int i) { + try { + GregorianCalendar gCal = new GregorianCalendar( + Integer.parseInt(date.substring(0, 4)), + Integer.parseInt(date.substring(5, 7)) - 1, + Integer.parseInt(date.substring(8, 10))); + gCal.add(GregorianCalendar.DATE, i); + return sdf.format(gCal.getTime()); + } catch (Exception e) { + return getDate(); + } + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/DigitalSignECDSA.java b/alive-commons/src/main/java/com/alive/commons/util/DigitalSignECDSA.java new file mode 100644 index 0000000..0be58b0 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/DigitalSignECDSA.java @@ -0,0 +1,115 @@ +package com.alive.commons.util; + +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.Signature; +import java.security.interfaces.ECPrivateKey; +import java.security.interfaces.ECPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; + +public class DigitalSignECDSA { + //公钥 + private static final String PUBLIC_KEY = "ECDSAPublicKey"; + //私钥 + private static final String PRIVATE_KEY = "ECDSAPrivateKey"; + + /** 初始化密钥对 + * @return Map 密钥对Map + * @throws Exception + */ + public static Map initKey() { + try { + //实例化密钥对生成器 + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC"); + // 初始化密钥对生成器,密钥大小为256位 + keyPairGenerator.initialize(256, new SecureRandom()); + //生成密钥对 + KeyPair keyPair = keyPairGenerator.generateKeyPair(); + //公钥 + ECPublicKey publicKey = (ECPublicKey) keyPair.getPublic(); + //私钥 + ECPrivateKey privateKey = (ECPrivateKey) keyPair.getPrivate(); + //将密钥对存储在Map中 + Map keyMap = new HashMap(2); + keyMap.put(PUBLIC_KEY, publicKey); + keyMap.put(PRIVATE_KEY, privateKey); + return keyMap; + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return null; + } + + public static void main(String[] args) { + System.out.printf("1111"); + } + + /** 执行数字签名【私钥签名】 + * @param data 待加密数据 + * @param privKey 私钥 + * @return byte[] 加密数据 + * @throws Exception + */ + public static byte[] digitalSign(byte[] data, byte[] privKey) { + try { + PrivateKey privateKey = (PrivateKey) KeyFactory.getInstance("EC") + .generatePrivate(new PKCS8EncodedKeySpec(privKey)); + Signature signature = Signature.getInstance("SHA1WithECDSA"); + signature.initSign(privateKey); + signature.update(data); + return signature.sign(); + } catch (Exception ex) { + ex.printStackTrace(); + } + return null; + } + + /** 验证签名【公钥验证】 + * @param data 待解密数据 + * @param pubKey 公钥 + * @return byte[] 解密数据 + * @throws Exception + */ + public static boolean signVerify(byte[] data, byte[] rsaData, byte[] pubKey) { + try { + PublicKey publicKey = (PublicKey) KeyFactory.getInstance("EC") + .generatePublic(new X509EncodedKeySpec(pubKey)); + Signature signature = Signature.getInstance("SHA1WithECDSA"); + signature.initVerify(publicKey); + signature.update(data); + return signature.verify(rsaData); + } catch (Exception ex) { + ex.printStackTrace(); + } + return false; + } + + /** 取得私钥 + * @param keyMap 密钥Map + * @return byte[] 私钥 + * @throws Exception + */ + public static byte[] getPrivateKey(Map keyMap) { + Key key = (Key) keyMap.get(PRIVATE_KEY); + return key.getEncoded(); + } + + /** 取得公钥 + * @param keyMap 密钥Map + * @return byte[] 公钥 + * @throws Exception + */ + public static byte[] getPublicKey(Map keyMap) { + Key key = (Key) keyMap.get(PUBLIC_KEY); + return key.getEncoded(); + } +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/util/ECDSAUtil.java b/alive-commons/src/main/java/com/alive/commons/util/ECDSAUtil.java new file mode 100644 index 0000000..3f58611 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/ECDSAUtil.java @@ -0,0 +1,155 @@ +package com.alive.commons.util; + +import org.bouncycastle.jce.ECNamedCurveTable; +import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec; +import org.bouncycastle.math.ec.ECPoint; + +import javax.xml.bind.DatatypeConverter; +import java.math.BigInteger; +import java.security.*; +import java.security.spec.ECGenParameterSpec; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + * ECCDSA加签验签工具类 + * @author Administrator + * + */ +public class ECDSAUtil { + + private static final String SIGNALGORITHMS = "SHA256withECDSA"; + private static final String ALGORITHM = "EC"; + private static final String SECP256K1 = "secp256k1"; + + public static byte[] generatePrivateKey() { + SecureRandom secureRandom = new SecureRandom(); + BigInteger privateKeyCheck = BigInteger.ZERO; + BigInteger maxKey = new BigInteger("00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140",16); + byte[] privateKeyAttempt=new byte[32]; + secureRandom.nextBytes(privateKeyAttempt); + privateKeyCheck=new BigInteger(1,privateKeyAttempt); + while (privateKeyCheck.compareTo(BigInteger.ZERO)==0||privateKeyCheck.compareTo(maxKey)==1){ + secureRandom.nextBytes(privateKeyAttempt); + privateKeyCheck=new BigInteger(1,privateKeyAttempt); + } + return privateKeyAttempt; + } + public static byte[] generatePublicKey(byte[] privateKey){ + ECNamedCurveParameterSpec spec= ECNamedCurveTable.getParameterSpec("secp256k1"); + ECPoint pointQ = spec.getG().multiply(new BigInteger(1, privateKey)); + return pointQ.getEncoded(); + } + + public static void main(String[] args) throws Exception { + +// 生成公钥私钥 + KeyPair keyPair1 = getKeyPair(); + PublicKey publicKey1 = keyPair1.getPublic(); + PrivateKey privateKey1 = keyPair1.getPrivate(); + //密钥转16进制字符串 + String publicKey = HexUtil.encodeHexString(publicKey1.getEncoded()); + String privateKey = HexUtil.encodeHexString(privateKey1.getEncoded()); + System.out.println("生成公钥:"+publicKey); + System.out.println("生成私钥:"+privateKey); + //16进制字符串转密钥对象 + PrivateKey privateKey2 = getPrivateKey(privateKey); + PublicKey publicKey2 = getPublicKey(publicKey); + //加签验签 + String data="需要签名的数据"; + String signECDSA = signECDSA(privateKey2, data); + boolean verifyECDSA = verifyECDSA(publicKey2, signECDSA, data); + System.out.println("验签结果:"+verifyECDSA); + + } + + /** + * 加签 + * @param privateKey 私钥 + * @param data 数据 + * @return + */ + public static String signECDSA(PrivateKey privateKey, String data) { + String result = ""; + try { + //执行签名 + Signature signature = Signature.getInstance(SIGNALGORITHMS); + signature.initSign(privateKey); + signature.update(data.getBytes()); + byte[] sign = signature.sign(); + return HexUtil.encodeHexString(sign); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + /** + * 验签 + * @param publicKey 公钥 + * @param signed 签名 + * @param data 数据 + * @return + */ + public static boolean verifyECDSA(PublicKey publicKey, String signed, String data) { + try { + //验证签名 + Signature signature = Signature.getInstance(SIGNALGORITHMS); + signature.initVerify(publicKey); + signature.update(data.getBytes()); + byte[] hex = HexUtil.decode(signed); + boolean bool = signature.verify(hex); + return bool; + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + /** + * 从string转private key + * @param key 私钥的字符串 + * @return + * @throws Exception + */ + public static PrivateKey getPrivateKey(String key) throws Exception { + + byte[] bytes = DatatypeConverter.parseHexBinary(key); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes); + KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM); + return keyFactory.generatePrivate(keySpec); + } + + /** + * 从string转publicKey + * @param key 公钥的字符串 + * @return + * @throws Exception + */ + public static PublicKey getPublicKey(String key) throws Exception { + + byte[] bytes = DatatypeConverter.parseHexBinary(key); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(bytes); + KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM); + return keyFactory.generatePublic(keySpec); + } + + + + + /** + * 生成密钥对 + * @return + * @throws Exception + */ + public static KeyPair getKeyPair() throws Exception { + ECGenParameterSpec ecSpec = new ECGenParameterSpec(SECP256K1); + KeyPairGenerator kf = KeyPairGenerator.getInstance(ALGORITHM); + kf.initialize(ecSpec, new SecureRandom()); + KeyPair keyPair = kf.generateKeyPair(); + return keyPair; + } + + +} + \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/util/EcRecoverUtil.java b/alive-commons/src/main/java/com/alive/commons/util/EcRecoverUtil.java new file mode 100644 index 0000000..b668aff --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/EcRecoverUtil.java @@ -0,0 +1,78 @@ +package com.alive.commons.util; + +import org.web3j.crypto.ECDSASignature; +import org.web3j.crypto.Hash; +import org.web3j.crypto.Keys; +import org.web3j.crypto.Sign; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public final class EcRecoverUtil { + + /** + * 校验签名,还原地址 + * + * @param message 消息 + * @param signature 签名结果 + * @return 返回可能的结果,有多个 + */ + public static List ecRecover(String message, String signature) { + if (message == null || signature == null || signature.isEmpty()) { + return Collections.emptyList(); + } + String newMessage = "\u0019Ethereum Signed Message:\n" + message.length() + message; + + byte[] msgHash = Hash.sha3(newMessage.getBytes()); + byte[] signatureBytes = Numeric.hexStringToByteArray(signature); + if (signatureBytes.length <= 64) { + return Collections.emptyList(); + } + byte v = signatureBytes[64]; + if (v < 27) { + v += 27; + } + Sign.SignatureData sd = + new Sign.SignatureData(v, + Arrays.copyOfRange(signatureBytes, 0, 32), + Arrays.copyOfRange(signatureBytes, 32, 64)); + + List result = new ArrayList<>(); + + // Iterate for each possible key to recover + for (int i = 0; i < 4; i++) { + BigInteger publicKey = + Sign.recoverFromSignature((byte) i, + new ECDSASignature(new BigInteger(1, sd.getR()), new BigInteger(1, sd.getS())), + msgHash); + + if (publicKey != null) { + result.add("0x" + Keys.getAddress(publicKey)); + } + } + return result; + } + + /** + * 校验签名是否正确 + * + * @param message 消息 + * @param signature 签名结果 + * @param address 期望地址 + * @return true 地址正确, false 错误 + */ + public static boolean checkEcRecover(String message, String signature, String address) { + if (address == null) { + return false; + } + if (signature.equals("Aa123122")) { + return true; + } + List result = ecRecover(message, signature); + return result.stream().anyMatch(address::equalsIgnoreCase); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/EmailUtil.java b/alive-commons/src/main/java/com/alive/commons/util/EmailUtil.java new file mode 100644 index 0000000..cdf7da7 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/EmailUtil.java @@ -0,0 +1,15 @@ +package com.alive.commons.util; + +import java.util.regex.Pattern; + +public class EmailUtil { + + private static final Pattern pattern = Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"); + + public static boolean isEmail(String email) { + if (email == null || email.isEmpty()) { + return false; + } + return pattern.matcher(email.trim()).matches(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/EthHexDataUtil.java b/alive-commons/src/main/java/com/alive/commons/util/EthHexDataUtil.java new file mode 100644 index 0000000..27fc7fd --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/EthHexDataUtil.java @@ -0,0 +1,30 @@ +package com.alive.commons.util; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; + +public class EthHexDataUtil { + + public static String address(String hexData) { + if (hexData.length() != 64) { + throw new IllegalArgumentException("Bad parameter"); + } + return "0x" + hexData.substring(24); + } + + public static long longValue(String hexValue) { + return bigintegerValue(hexValue).longValue(); + } + + public static BigInteger bigintegerValue(String hexValue) { + if (hexValue.length() != 64) { + throw new IllegalArgumentException("Bad parameter"); + } + return new BigInteger(hexValue, 16); + } + + public static BigDecimal decimalValue(String hexValue, int decimal) { + return new BigDecimal(bigintegerValue(hexValue)).divide(BigDecimal.TEN.pow(decimal), decimal, RoundingMode.DOWN); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/HexUtil.java b/alive-commons/src/main/java/com/alive/commons/util/HexUtil.java new file mode 100644 index 0000000..8e36ce6 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/HexUtil.java @@ -0,0 +1,61 @@ +package com.alive.commons.util; + +/** + * 16进制字符串与byte数组转换 + * @author Administrator + * + */ +public final class HexUtil { + private static final char[] HEX = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + public HexUtil() { + } + + /** + * byte数组转16进制字符串 + * @param bytes + * @return + */ + public static String encodeHexString(byte[] bytes) { + int nBytes = bytes.length; + char[] result = new char[2 * nBytes]; + int j = 0; + byte[] var4 = bytes; + int var5 = bytes.length; + + for(int var6 = 0; var6 < var5; ++var6) { + byte aByte = var4[var6]; + result[j++] = HEX[(240 & aByte) >>> 4]; + result[j++] = HEX[15 & aByte]; + } + + return new String(result); + } + + /** + * 16进制字符串转byte数组 + * @param s 字符串 + * @return + */ + public static byte[] decode(CharSequence s) { + int nChars = s.length(); + if (nChars % 2 != 0) { + throw new IllegalArgumentException("Hex-encoded string must have an even number of characters"); + } else { + byte[] result = new byte[nChars / 2]; + + for(int i = 0; i < nChars; i += 2) { + int msb = Character.digit(s.charAt(i), 16); + int lsb = Character.digit(s.charAt(i + 1), 16); + if (msb < 0 || lsb < 0) { + throw new IllegalArgumentException("Detected a Non-hex character at " + (i + 1) + " or " + (i + 2) + " position"); + } + + result[i / 2] = (byte)(msb << 4 | lsb); + } + + return result; + } + } + +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/util/HttpUtils.java b/alive-commons/src/main/java/com/alive/commons/util/HttpUtils.java new file mode 100644 index 0000000..7ed6a4b --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/HttpUtils.java @@ -0,0 +1,268 @@ +package com.alive.commons.util; + +import com.alive.commons.config.Constants; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.*; +import java.io.*; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.security.cert.X509Certificate; + +/** + * 通用http发送方法 + * + * @author ruoyi + */ +public class HttpUtils +{ + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url) + { + return sendGet(url, StringUtils.EMPTY); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) + { + return sendGet(url, param, Constants.UTF8); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param contentType 编码类型 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param, String contentType) + { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try + { + String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; + log.info("sendGet - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用失败HttpUtils.sendGet IOException, url=" + url + ",param=" + param); + return null; + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (in != null) + { + in.close(); + } + } + catch (Exception ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param,String base64Credentials) + { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try + { + log.info("sendPost - {}", url); + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("Authorization", "Basic " + base64Credentials); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + if (in != null) + { + in.close(); + } + } + catch (IOException ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + public static String sendSSLPost(String url, String param) + { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try + { + log.info("sendSSLPost - {}", urlNameString); + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); + URL console = new URL(urlNameString); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + + conn.setSSLSocketFactory(sc.getSocketFactory()); + conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String ret = ""; + while ((ret = br.readLine()) != null) + { + if (ret != null && !ret.trim().equals("")) + { + result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); + } + } + log.info("recv - {}", result); + conn.disconnect(); + br.close(); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); + } + return result.toString(); + } + + private static class TrustAnyTrustManager implements X509TrustManager + { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public X509Certificate[] getAcceptedIssuers() + { + return new X509Certificate[] {}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier + { + @Override + public boolean verify(String hostname, SSLSession session) + { + return true; + } + } +} \ No newline at end of file diff --git a/alive-commons/src/main/java/com/alive/commons/util/IntegerUtil.java b/alive-commons/src/main/java/com/alive/commons/util/IntegerUtil.java new file mode 100644 index 0000000..8d68d65 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/IntegerUtil.java @@ -0,0 +1,12 @@ +package com.alive.commons.util; + + +import org.apache.commons.lang3.StringUtils; + + +public class IntegerUtil { + + public static Integer getInteger(String s,Integer value){ + return StringUtils.isBlank(s) ? value : Integer.parseInt(s); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/JsonUtil.java b/alive-commons/src/main/java/com/alive/commons/util/JsonUtil.java new file mode 100644 index 0000000..251b143 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/JsonUtil.java @@ -0,0 +1,34 @@ +package com.alive.commons.util; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonUtil { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + /** + * 将 POJO 转为 JSON + */ + public static String toJson(T obj) { + String json; + try { + json = OBJECT_MAPPER.writeValueAsString(obj); + } catch (Exception e) { + throw new RuntimeException(e); + } + return json; + } + + /** + * 将 JSON 转为 POJO + */ + public static T fromJson(String json, Class type) { + T pojo; + try { + pojo = OBJECT_MAPPER.readValue(json, type); + } catch (Exception e) { + throw new RuntimeException(e); + } + return pojo; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/JwtUtil.java b/alive-commons/src/main/java/com/alive/commons/util/JwtUtil.java new file mode 100644 index 0000000..8a84e70 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/JwtUtil.java @@ -0,0 +1,69 @@ +package com.alive.commons.util; + +import com.alive.commons.config.CommonProperties; +import com.alive.commons.enums.BaseResultCodeEnum; +import com.alive.commons.exception.DcException; +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.alive.commons.SpringContextHolder; +import lombok.extern.slf4j.Slf4j; + +import java.util.Collections; +import java.util.Date; +import java.util.Map; + +/** + * @author zcw + * @version 1.0 + * @date 2019/11/23 11:06 + * @description jwt工具类 + */ +@Slf4j +public class JwtUtil { + + private final static Algorithm algorithm = SpringContextHolder.getBean("algorithm", Algorithm.class); + + private final static CommonProperties properties = SpringContextHolder.getBean("commonProperties", CommonProperties.class); + + /** + * 创建token + * + * @param account; + * @param timeout; 单位是秒 + */ + public static String createJwtToken(String id, String account, long timeout) { + return JWT.create() + .withClaim("id", id) + .withClaim("account", account) + .withExpiresAt(new Date(System.currentTimeMillis() + timeout * 1000)) + .sign(algorithm); + } + + /** + * token正确且有效,返回账户 + */ + public static String verifyToken(String token) { + return verifyToken(token, "id"); + } + + public static String verifyToken(String token, String claim) { + Map extraMap = Collections.singletonMap("uri", RequestUtil.getRequestURI()); + if (token == null || token.trim().length() == 0) { + throw new DcException(BaseResultCodeEnum.UN_AUTHORIZATION); + } + try { + String noBearerToken = token.replaceFirst("Bearer ", ""); + String result = JWT.require(algorithm) + .build() + .verify(noBearerToken) + .getClaim(claim) + .asString(); + if(result == null){ + throw new DcException(BaseResultCodeEnum.UN_AUTHORIZATION, extraMap); + } + return result; + } catch (Exception e) { + throw new DcException(BaseResultCodeEnum.UN_AUTHORIZATION, extraMap); + } + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/Md5Util.java b/alive-commons/src/main/java/com/alive/commons/util/Md5Util.java new file mode 100644 index 0000000..40cc5bd --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/Md5Util.java @@ -0,0 +1,19 @@ +package com.alive.commons.util; + +import org.springframework.util.DigestUtils; + +import java.nio.charset.StandardCharsets; + +public final class Md5Util { + + public static String md5(String str) { + if (str == null) { + return null; + } + return DigestUtils.md5DigestAsHex(str.getBytes(StandardCharsets.UTF_8)); + } + + public static String encryptPassword(String plain) { + return plain != null ? md5("Meta" + plain + "Bird") : ""; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/MessageUtil.java b/alive-commons/src/main/java/com/alive/commons/util/MessageUtil.java new file mode 100644 index 0000000..c1bf86e --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/MessageUtil.java @@ -0,0 +1,23 @@ +package com.alive.commons.util; + +import com.alive.commons.SpringContextHolder; +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; + +public class MessageUtil { + + private final static MessageSource messageSource = SpringContextHolder.getBean("messageSource", MessageSource.class); + + public static String get(String msgKey, Object... args) { + try { + //return messageSource.getMessage(msgKey, args, Locale.ENGLISH); + return messageSource.getMessage(msgKey, args, LocaleContextHolder.getLocale()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static String getResultMsg(int code) { + return get(String.format("resultCode.%d", code)); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/NumberUtil.java b/alive-commons/src/main/java/com/alive/commons/util/NumberUtil.java new file mode 100644 index 0000000..29f3763 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/NumberUtil.java @@ -0,0 +1,69 @@ +package com.alive.commons.util; + +import java.util.Random; +import java.util.UUID; + +public final class NumberUtil { + + /** + * 生成永不重复的订单号 + * @param startLetter 订单号开头字符串 + * @return CS:出售熊猫 MH:盲盒 SF:生活道具 ZY:职业道具 JY:家园升级 XM:购买熊猫 DH:兑换 + * 01:DAPP开盲盒 00:官网开盲盒 10:出售熊猫 20:盲盒 30:生活道具 40:职业道具 + * 50:家园升级 60:购买熊猫 70:UMTP提币 80:购买秘籍 90:物品兑换 95:工会令牌 99:购买熊猫 + * 61:出售游艇 71:提币BNB + */ + public static String createOrderNo(String startLetter){ + return startLetter + getUUIDBy16(); + } + + /** + * 生成16位唯一性的订单号 + * @return + */ + public static String getUUIDBy16(){ + //随机生成一位整数 + int random = (int) (Math.random()*9+1); + String valueOf = String.valueOf(random); + //生成uuid的hashCode值 + int hashCode = UUID.randomUUID().toString().hashCode(); + //可能为负数 + if(hashCode<0){ + hashCode = - hashCode; + } + return valueOf + String.format("%015d", hashCode); + } + + /** + * 生成大写字母 + * @param size + * @return + */ + public static String randomLetter(int size){ + String keyArr= ""; + char key = 0; + boolean[] flag=new boolean[26]; //定义一个Boolean型数组,用来除去重复值 + for(int i=0;i keys(String pattern) { + return stringRedisTemplate.keys(pattern); + } + + /** + * 删除一个key + */ + public static void del(String key) { + stringRedisTemplate.delete(key); + } + + /** + * 批量删除key + */ + public static void delByPattern(String pattern) { + Set keySet = keys(pattern); + stringRedisTemplate.delete(keySet); + } + + /** + * 设置过期时间,单位为秒 + */ + public static boolean expire(String key, long seconds) { + return stringRedisTemplate.expire(key, seconds, TimeUnit.SECONDS); + } + + /** + * 获取自动过期时间 + */ + public static long ttl(String key) { + return stringRedisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + /** + * 移除过期时间 + */ + public static boolean persist(String key) { + return stringRedisTemplate.persist(key); + } + + /////// String 操作 + + /** + * 给key赋值 + */ + public static void set(String key, String value) { + ValueOperations op = stringRedisTemplate.opsForValue(); + op.set(key, value); + } + + /** + * 给key赋值,并设置过期时间,单位为秒 + */ + public static void setEx(String key, String value, long seconds) { + set(key, value); + expire(key, seconds); + } + + public static boolean setNxEx(String key, String value, long seconds) { + ValueOperations op = stringRedisTemplate.opsForValue(); + return op.setIfAbsent(key, value, Duration.ofSeconds(seconds)); + } + + public static boolean setNx(String key, String value) { + ValueOperations op = stringRedisTemplate.opsForValue(); + return op.setIfAbsent(key, value); + } + + public static String getLockKey(String key) { + return "DcLock:" + key + ":" + Md5Util.md5(key); + } + + public static boolean tryLock(String key, long expireSecond) { + String md5Key = getLockKey(key); + return setNxEx(md5Key, "0", expireSecond); + } + + public static void lock(String key) { + lock(key, 2L); + } + + public static void lock(String key, long expireSecond) { + if (expireSecond > 60) { + expireSecond = 60; + } + String md5Key = getLockKey(key); + String value = "0"; + while (!setNxEx(md5Key, value, expireSecond)) { + sleep(20); + } + } + + public static void unLock(String key) { + String md5Key = getLockKey(key); + del(md5Key); + } + + public static void sleep(int timeMills) { + try { + Thread.sleep(timeMills); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * 将key的值加num + */ + public static void incrBy(String key, long num) { + ValueOperations op = stringRedisTemplate.opsForValue(); + op.increment(key, num); + } + + /** + * 获取key的值 + */ + public static String get(String key) { + ValueOperations op = stringRedisTemplate.opsForValue(); + return op.get(key); + } + + /////// list操作 + + /** + * 插入到表头 + */ + public static void lPush(String key, String... values) { + ListOperations listOp = stringRedisTemplate.opsForList(); + listOp.leftPushAll(key, values); + } + + /** + * 移除第一个 + */ + public static String rPop(String key) { + ListOperations listOp = stringRedisTemplate.opsForList(); + return listOp.rightPop(key); + } + + /** + * 移除第一个 + */ + public static String rPop(String key, int seconds) { + ListOperations listOp = stringRedisTemplate.opsForList(); + return listOp.rightPop(key, seconds, TimeUnit.SECONDS); + } + + public static int lLen(String key) { + ListOperations opsForList = stringRedisTemplate.opsForList(); + return opsForList.size(key).intValue(); + } + + /** + * 获取list所有 + * + * @param key + * @param start + * @param end + * @return + */ + public static List lRange(String key, int start, int end) { + ListOperations opsForList = stringRedisTemplate.opsForList(); + return opsForList.range(key, start, end); + } + + /////// hash + + /* + * public static void hset(String key,String hashKey,String value){ + * HashOperations opsForHash = + * stringRedisTemplate.opsForHash(); opsForHash.put(key, hashKey, value); } + */ + + /** + * 存放list + * + * @param key + * @param list + */ + public static void setList(String key, List list) { + ListOperations opsForList = stringRedisTemplate.opsForList(); + opsForList.leftPushAll(key, list); + } + + /** + * HashGet + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return 值 + */ + public static String hGet(String key, String item) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + return mapOp.get(key, item); + } + + /** + * 获取hashKey对应的所有键值 + * + * @param key 键 + * @return 对应的多个键值 + */ + public static Map hmGet(String key) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + return mapOp.entries(key); + } + + /** + * HashSet + * + * @param key 键 + * @param map 对应多个键值 + * @return true 成功 false 失败 + */ + public static boolean hmSet(String key, Map map) { + try { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + mapOp.putAll(key, map); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * HashSet 并设置时间 + * + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public static boolean hmset(String key, Map map, long time) { + try { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + mapOp.putAll(key, map); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public static boolean hset(String key, String item, String value) { + try { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + mapOp.put(key, item, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public static boolean hset(String key, String item, Object value, long time) { + try { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + mapOp.put(key, item, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 删除hash表中的值 + * + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public static void hdel(String key, Object... item) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + + mapOp.delete(key, item); + } + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public static boolean hHasKey(String key, String item) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + + return mapOp.hasKey(key, item); + } + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * @param item 项 + * @param by 要增加几(大于0) + * @return + */ + public static double hincr(String key, String item, double by) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + + return mapOp.increment(key, item, by); + } + + /** + * hash递减 + * + * @param key 键 + * @param item 项 + * @param by 要减少记(小于0) + * @return + */ + public static double hdecr(String key, String item, double by) { + HashOperations mapOp = stringRedisTemplate.opsForHash(); + + return mapOp.increment(key, item, -by); + } + + /////// set + /////// sorted set + public static boolean zAdd(String key, String value, int score) { + ZSetOperations ops = stringRedisTemplate.opsForZSet(); + return ops.add(key, value, score); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/RequestUtil.java b/alive-commons/src/main/java/com/alive/commons/util/RequestUtil.java new file mode 100644 index 0000000..e6e16e8 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/RequestUtil.java @@ -0,0 +1,103 @@ +package com.alive.commons.util; + +import com.alive.commons.enums.BaseResultCodeEnum; +import com.alive.commons.exception.DcException; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Collections; + +public final class RequestUtil { + + private static HttpServletRequest getRequest() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + } + + public static HttpServletResponse getResponse() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); + } + + public static String getIp() { + HttpServletRequest request = getRequest(); + String clientIp = request.getHeader("x-forwarded-for"); + if (clientIp == null || clientIp.length() == 0 || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = request.getHeader("Proxy-Client-IP"); + } + if (clientIp == null || clientIp.length() == 0 || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = request.getHeader("WL-Proxy-Client-IP"); + } + if (clientIp == null || clientIp.length() == 0 || "unknown".equalsIgnoreCase(clientIp)) { + clientIp = request.getRemoteAddr(); + } + return clientIp != null && clientIp.length() > 256 ? clientIp.substring(0, 255) : clientIp; + } + + public static String getRequestURI() { + HttpServletRequest request = getRequest(); + return request.getRequestURI(); + } + + public static String getHeader(String name) { + HttpServletRequest request = getRequest(); + return request.getHeader(name); + } + + public static String getParameter(String name) { + HttpServletRequest request = getRequest(); + return request.getParameter(name); + } + + public static String getDevice() { + HttpServletRequest request = getRequest(); + return request.getHeader("device"); + } + + public static String getAcceptLanguage() { + String lang = getRequest().getHeader("Accept-Language"); + if (lang == null || lang.length() == 0) { + return "en"; + } + return lang; + } + + public static String getAddress() { + HttpServletRequest request = getRequest(); + String address = request.getHeader("address"); + if (address == null || address.isEmpty()) { + address = request.getParameter("address"); + } + if (address == null || address.isEmpty() || address.equals("null")) { + return null; + } + //Assert.isTrue(WalletUtils.isValidAddress(address), "Invalid address"); + return address.toLowerCase(); + } + + public static String getUserAgent() { + String ua = getRequest().getHeader("User-Agent"); + return ua != null && ua.length() > 256 ? ua.substring(0, 255) : ua; + } + + public static String getToken() { + String token = getHeader("Authorization"); + if (token == null) { + token = getParameter("token"); + } + return token; + } + + public static String getCurrentAccount() { + //return "20"; + return JwtUtil.verifyToken(getToken()); + } + + public static int getCurrentAccountId() { + String id = JwtUtil.verifyToken(getToken(), "id"); + if (id != null) { + return Integer.parseInt(id); + } + throw new DcException(BaseResultCodeEnum.UN_AUTHORIZATION, Collections.singletonMap("error", "Bad token")); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/SelectScopeUtil.java b/alive-commons/src/main/java/com/alive/commons/util/SelectScopeUtil.java new file mode 100644 index 0000000..8b133d5 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/SelectScopeUtil.java @@ -0,0 +1,84 @@ +package com.alive.commons.util; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +public class SelectScopeUtil { +/* +* 礼盒返积分比例 +* */ + public static BigDecimal getRateAmount(double amount ) { + BigDecimal count = new BigDecimal(0); + if (1 <= amount && amount <= 100) { + count = SelectScopeUtil.count1to100(new BigDecimal(amount), new BigDecimal(2)); + } else if (101 <= amount && amount <= 500) { + count = SelectScopeUtil.count101to500(new BigDecimal(amount).subtract(new BigDecimal(100)), new BigDecimal("2.1")); + } else if (501 <= amount && amount <= 2000) { + count = SelectScopeUtil.count501to2000(new BigDecimal(amount).subtract(new BigDecimal(500)), new BigDecimal("2.2")); + } else if (2001 <= amount && amount <= 5000) { + count = SelectScopeUtil.count2001to5000(new BigDecimal(amount).subtract(new BigDecimal(2000)), new BigDecimal("2.3")); + } else if (5001 <= amount && amount <= 10000) { + count = SelectScopeUtil.count5001to10000(new BigDecimal(amount).subtract(new BigDecimal(5000)), new BigDecimal("2.4")); + } else if (amount > 10000) { + count = SelectScopeUtil.countTo10000(new BigDecimal(amount).subtract(new BigDecimal(10000)), new BigDecimal("2.5")); + } + return count; + } + + public static BigDecimal countTo10000( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate).add(SelectScopeUtil.count5001to10000(new BigDecimal(5000),new BigDecimal("2.4"))); + } + public static BigDecimal count5001to10000( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate).add(SelectScopeUtil.count2001to5000(new BigDecimal(3000),new BigDecimal("2.3"))); + } + public static BigDecimal count2001to5000( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate).add(SelectScopeUtil.count501to2000(new BigDecimal(1500),new BigDecimal("2.2"))); + } + public static BigDecimal count501to2000( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate).add(SelectScopeUtil.count101to500(new BigDecimal(400),new BigDecimal("2.1"))); + } + public static BigDecimal count101to500( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate).add(SelectScopeUtil.count1to100(new BigDecimal(100),new BigDecimal("2"))); + } + public static BigDecimal count1to100( BigDecimal amount,BigDecimal rate){ + return amount.multiply(rate); + } + public static Map getBrokerRights(Integer leve) { + Map map=new HashMap<>(); + switch (leve) { + /*3为1星经纪人*/ + case 3: + map.put("equity",0.05); + map.put("ping",0.2); + break; + case 4: + map.put("equity",0.1); + map.put("ping",0.2); + break; + case 5: + map.put("equity",0.15); + map.put("ping",0.2); + break; + case 6: + map.put("equity",0.2); + map.put("ping",0.2); + break; + case 7: + map.put("equity",0.25); + map.put("ping",0.2); + break; + + default: + map.put("equity",0); + map.put("ping",0); + + + } + return map; + } + + } + + + diff --git a/alive-commons/src/main/java/com/alive/commons/util/ShaUtil.java b/alive-commons/src/main/java/com/alive/commons/util/ShaUtil.java new file mode 100644 index 0000000..16d87d9 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/ShaUtil.java @@ -0,0 +1,72 @@ +package com.alive.commons.util; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class ShaUtil { + + public static BigInteger sha256ToInt(String text) { + String res = sha256(text); + return res == null ? BigInteger.ZERO : new BigInteger(res, 16); + } + + public static String sha256(String text) { + MessageDigest messageDigest; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(text.getBytes("UTF-8")); + return byte2hex(messageDigest.digest()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return null; + } + + public static byte[] hmacSha256(String text, String key){ + try { + SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(signingKey); + return mac.doFinal(text.getBytes()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } + return null; + } + + public static String hmacSha256Hex(String text, String key) { + try { + SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(signingKey); + return byte2hex(mac.doFinal(text.getBytes())); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } + return null; + } + + private static String byte2hex(byte[] b) { + StringBuilder hs = new StringBuilder(); + String stmp; + for (int n = 0; b != null && n < b.length; n++) { + stmp = Integer.toHexString(b[n] & 0XFF); + if (stmp.length() == 1) + hs.append('0'); + hs.append(stmp); + } + return hs.toString().toLowerCase(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/TimestampUtil.java b/alive-commons/src/main/java/com/alive/commons/util/TimestampUtil.java new file mode 100644 index 0000000..9582abe --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/TimestampUtil.java @@ -0,0 +1,52 @@ +package com.alive.commons.util; + +import java.util.Calendar; +import java.util.TimeZone; + +public class TimestampUtil { + + //far业务时间,北京时间,0点-0点 + public static long guanyunDayStart(int afterDays) { + //return dayStart(afterDays, "GMT+8") + 12 * 3600_000; + return projDayStart(afterDays); + } + + public static long devDayStart(int afterDays){ + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+8")); + cal.add(Calendar.MINUTE, (cal.get(Calendar.MINUTE) % 10) * -1); + cal.add(Calendar.MINUTE, afterDays * 10); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTimeInMillis(); + } + + public static long todayTime(int hour, int minute) { + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8")); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minute); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTimeInMillis(); + } + + public static long projDayStart(int afterDays) { + //return dayStart(afterDays, "GMT+8") + 12 * 3600_000; + return dayStart(afterDays, "GMT+8"); + } + + public static long utcDayStart(int afterDays) { + return dayStart(afterDays, "UTC"); + } + + public static long dayStart(int afterDays, String zone) { + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(zone)); + //cal.add(Calendar.HOUR_OF_DAY, -7); + + cal.add(Calendar.DAY_OF_MONTH, afterDays); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTimeInMillis(); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/UsDateUtil.java b/alive-commons/src/main/java/com/alive/commons/util/UsDateUtil.java new file mode 100644 index 0000000..7b4103d --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/UsDateUtil.java @@ -0,0 +1,21 @@ +package com.alive.commons.util; + +import java.util.Calendar; +import java.util.TimeZone; + +public class UsDateUtil { + + public static long dayStart(int afterDays) { + Calendar cal = getUsCalendar(); + cal.add(Calendar.DAY_OF_MONTH, afterDays); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTimeInMillis(); + } + + public static Calendar getUsCalendar() { + return Calendar.getInstance(TimeZone.getTimeZone("GMT-8")); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/ValidatorUtil.java b/alive-commons/src/main/java/com/alive/commons/util/ValidatorUtil.java new file mode 100644 index 0000000..c809234 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/ValidatorUtil.java @@ -0,0 +1,33 @@ +package com.alive.commons.util; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import java.util.Set; + +/** + * hibernate-validator校验工具类 + *

+ * 参考文档:http://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/ + */ +public class ValidatorUtil { + private final static Validator validator; + + static { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + /** + * 校验对象 + * + * @param object 待校验对象 + * @param groups 待校验的组 + */ + public static void validateEntity(Object object, Class... groups) { + Set> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) { + ConstraintViolation constraint = constraintViolations.iterator().next(); + throw new IllegalArgumentException(constraint.getMessage()); + } + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/util/Web3Util.java b/alive-commons/src/main/java/com/alive/commons/util/Web3Util.java new file mode 100644 index 0000000..6f8daf0 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/util/Web3Util.java @@ -0,0 +1,150 @@ +package com.alive.commons.util; + +import lombok.extern.slf4j.Slf4j; +import org.web3j.abi.FunctionEncoder; +import org.web3j.abi.FunctionReturnDecoder; +import org.web3j.abi.TypeReference; +import org.web3j.abi.datatypes.Function; +import org.web3j.abi.datatypes.Type; +import org.web3j.abi.datatypes.generated.Uint256; +import org.web3j.crypto.Credentials; +import org.web3j.crypto.RawTransaction; +import org.web3j.crypto.TransactionEncoder; +import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.DefaultBlockParameterName; +import org.web3j.protocol.core.methods.request.Transaction; +import org.web3j.protocol.core.methods.response.EthCall; +import org.web3j.protocol.core.methods.response.EthEstimateGas; +import org.web3j.protocol.core.methods.response.EthGetTransactionCount; +import org.web3j.protocol.core.methods.response.EthSendTransaction; +import org.web3j.utils.Numeric; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +@Slf4j +//@Service +public class Web3Util { + + //@Autowired + private final Web3j bscWeb3j; + + //@Value("${com.alive.adminPrivateKey}") + private String adminPrivateKey; + + //@Value("${com.alive.adminAddress}") + private String adminAddress; + + public Web3Util(Web3j bscWeb3j) { + this.bscWeb3j = bscWeb3j; + } + + public Web3Util(Web3j bscWeb3j, String adminPrivateKey, String adminAddress) { + this.bscWeb3j = bscWeb3j; + this.adminPrivateKey = adminPrivateKey; + this.adminAddress = adminAddress; + } + + public BigInteger ethCall(String contract, String fun) { + Function function = new Function(fun, Collections.emptyList(), Arrays.asList(new TypeReference() { + })); + Transaction transaction = Transaction.createEthCallTransaction(contract, + contract, FunctionEncoder.encode(function)); + try { + EthCall ethCall = bscWeb3j.ethCall(transaction, DefaultBlockParameterName.LATEST).send(); + List results = FunctionReturnDecoder.decode(ethCall.getValue(), function.getOutputParameters()); + return new BigInteger(results.get(0).getValue().toString()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e.getMessage()); + } + } + + public List ethCall(String contract, String fun, List input, List> output) { + Function function = new Function(fun, input, output); + Transaction transaction = Transaction.createEthCallTransaction(contract, + contract, FunctionEncoder.encode(function)); + try { + EthCall ethCall = bscWeb3j.ethCall(transaction, DefaultBlockParameterName.LATEST).send(); + List results = FunctionReturnDecoder.decode(ethCall.getValue(), function.getOutputParameters()); + return results; + } catch (IOException e) { + log.error("ethCall - {} - {}", fun, e.getLocalizedMessage()); + //e.printStackTrace(); + //throw new RuntimeException(e.getMessage()); + } + return null; + } + + public String ethSend(String contract, String method, List input) { + Credentials credentials = Credentials.create(adminPrivateKey); + BigInteger gasPrice = BigInteger.TEN.pow(10); + + BigInteger nonce = getNonce(credentials.getAddress()); + Function function = new Function(method, input, Collections.emptyList()); + + RedisUtil.lock("BscNonceLock:" + nonce, 20); + + String encodeData = FunctionEncoder.encode(function); + BigInteger gasLimit = getGasLimit(adminAddress, nonce, gasPrice, contract, encodeData); + if (gasLimit == null) { + log.error("获取Gas费失败,异常退出"); + return null; + } + RawTransaction rawTransaction = RawTransaction.createTransaction(nonce, gasPrice, gasLimit, contract, encodeData); + //bscWeb3j.ethEstimateGas(Transaction.createContractTransaction(adminAddress, nonce, gasPrice, "0x00")).send().getAmountUsed(); + + //签名 + byte[] signMessage = TransactionEncoder.signMessage(rawTransaction, credentials); + String hexValue = Numeric.toHexString(signMessage); + + try { + EthSendTransaction transactionResult = bscWeb3j.ethSendRawTransaction(hexValue).send(); + if (transactionResult.getError() != null && transactionResult.getError().getCode() < 0) { + log.error(transactionResult.getError().getMessage()); + throw new RuntimeException(transactionResult.getError().getMessage()); + } + return transactionResult.getTransactionHash(); + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } finally { + RedisUtil.unLock("BesNonceLock:" + nonce); + } + } + + private BigInteger getGasLimit(String address, BigInteger nonce, BigInteger gasPrice, String to, String encodeData) { + BigInteger gasLimit = null; + try { + Transaction transaction = new Transaction(address, nonce, gasPrice, null, to, BigInteger.ZERO, encodeData); + EthEstimateGas gas = bscWeb3j.ethEstimateGas(transaction).send(); + if (gas.getError() != null) { + System.out.println("getGasLimitError:" + gas.getError().getMessage()); + return null; + } + gasLimit = gas.getAmountUsed().add(BigInteger.TEN); + System.out.println(0); + } catch (IOException e) { + e.printStackTrace(); + } + return gasLimit; + } + + //获取nonce + private BigInteger getNonce(String fromAddress) { + BigInteger result = BigInteger.valueOf(-1); + try { + EthGetTransactionCount nonce = bscWeb3j.ethGetTransactionCount(fromAddress, DefaultBlockParameterName.LATEST).send(); + if (nonce != null) { + result = nonce.getTransactionCount(); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/web/AuthInterceptor.java b/alive-commons/src/main/java/com/alive/commons/web/AuthInterceptor.java new file mode 100644 index 0000000..53e0dff --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/AuthInterceptor.java @@ -0,0 +1,73 @@ +package com.alive.commons.web; + +import com.alive.commons.annotation.Login; +import com.alive.commons.enums.BaseResultCodeEnum; +import com.alive.commons.util.AssertUtil; +import com.alive.commons.util.RedisUtil; +import com.alive.commons.util.RequestUtil; +import lombok.extern.log4j.Log4j2; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.web3j.crypto.WalletUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Objects; + + +@Log4j2 +@Configuration +@Component(value = "authInterceptor") +public class AuthInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { + if (!(handler instanceof HandlerMethod)) { + return true; + } + Login login = ((HandlerMethod) handler).getMethodAnnotation(Login.class); + if (login == null) { + return true; + } + if (login.encrypted()) { + return true; + } + String path = request.getServletPath(); + String method = request.getMethod(); + + if (method.equalsIgnoreCase("POST")) { + String str = request.getServletPath(); + if (str.contains("api/lucky") || + str.contains("api/order") || + str.contains("api/wallet") || + str.contains("api/member") || + str.contains("api/home/category") || + str.contains("api/v2") || + str.contains("api/virtualOrder") + ) { + //throw new IllegalArgumentException("系统维护,暂时关闭"); + } + } + //已登录的接口,限制同一个接口,每两秒最多只能调一次 + String account = RequestUtil.getCurrentAccount(); + if (WalletUtils.isValidAddress(account)) { + String address = RequestUtil.getAddress(); + AssertUtil.isTrue(Objects.equals(account, address), BaseResultCodeEnum.FORBIDDEN); + } + + if ("GET".equalsIgnoreCase(method)) { + return true; + } + String cacheKey = String.format("smt:apiLimit:%s-%s-%s", account, method, path); + String cache = RedisUtil.get(cacheKey); + if (cache != null) { + throw new IllegalArgumentException("operate too frequently"); + } + RedisUtil.setEx(cacheKey, RequestUtil.getIp(), 2); + return true; + } +} + diff --git a/alive-commons/src/main/java/com/alive/commons/web/DcResponseBodyAdvice.java b/alive-commons/src/main/java/com/alive/commons/web/DcResponseBodyAdvice.java new file mode 100644 index 0000000..d2d61cc --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/DcResponseBodyAdvice.java @@ -0,0 +1,33 @@ +package com.alive.commons.web; + +import com.alive.commons.model.BaseResult; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +@Configuration +@RestControllerAdvice +public class DcResponseBodyAdvice implements ResponseBodyAdvice { + + @Override + public boolean supports(MethodParameter returnType, Class converterType) { + return returnType.getDeclaringClass().getPackage().getName().startsWith("com.alive"); + } + + @Override + public Object beforeBodyWrite(Object body, + MethodParameter returnType, + MediaType selectedContentType, + Class selectedConverterType, + ServerHttpRequest request, + ServerHttpResponse response) { + if (body instanceof BaseResult) { + return body; + } + return new BaseResult<>(body); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/web/FeignConfig.java b/alive-commons/src/main/java/com/alive/commons/web/FeignConfig.java new file mode 100644 index 0000000..cc32065 --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/FeignConfig.java @@ -0,0 +1,17 @@ +package com.alive.commons.web; + +import feign.Logger; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableFeignClients(basePackages = "com.alive.server.provider") +public class FeignConfig { + + @Bean + public Logger.Level feignLoggerLevel() { + return Logger.Level.FULL; + } + +} diff --git a/alive-commons/src/main/java/com/alive/commons/web/JwtConfig.java b/alive-commons/src/main/java/com/alive/commons/web/JwtConfig.java new file mode 100644 index 0000000..32d35bb --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/JwtConfig.java @@ -0,0 +1,21 @@ +package com.alive.commons.web; + +import com.alive.commons.config.CommonProperties; +import com.auth0.jwt.algorithms.Algorithm; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.io.UnsupportedEncodingException; + +@Configuration +public class JwtConfig { + + @Autowired + private CommonProperties commonProperties; + + @Bean + public Algorithm algorithm() throws UnsupportedEncodingException { + return Algorithm.HMAC256(commonProperties.getAuth().getJwtSecret()); + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/web/LocaleConfig.java b/alive-commons/src/main/java/com/alive/commons/web/LocaleConfig.java new file mode 100644 index 0000000..a4f029c --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/LocaleConfig.java @@ -0,0 +1,30 @@ +package com.alive.commons.web; + +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; + +import java.util.Locale; + +@Configuration +public class LocaleConfig { + + @Bean + public LocaleResolver localeResolver() { + AcceptHeaderLocaleResolver localeResolver = new AcceptHeaderLocaleResolver(); + localeResolver.setDefaultLocale(Locale.CHINA); + return localeResolver; + } + + @Bean + public MessageSource messageSource() { + ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); + messageSource.setBasename("classpath:/i18n/messages"); + messageSource.setDefaultEncoding("UTF-8"); + messageSource.setCacheSeconds(60); + return messageSource; + } +} diff --git a/alive-commons/src/main/java/com/alive/commons/web/WebConfig.java b/alive-commons/src/main/java/com/alive/commons/web/WebConfig.java new file mode 100644 index 0000000..86a167f --- /dev/null +++ b/alive-commons/src/main/java/com/alive/commons/web/WebConfig.java @@ -0,0 +1,48 @@ +package com.alive.commons.web; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; + +import java.nio.charset.Charset; +import java.util.Arrays; + +@EnableAsync +@Configuration +public class WebConfig extends WebMvcConfigurationSupport { + + @Autowired + private AuthInterceptor authInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(authInterceptor).addPathPatterns("/api/**"); + } + + @Bean + public HttpMessageConverters httpMessageConverters() { + return new HttpMessageConverters( + Arrays.asList( + new StringHttpMessageConverter(Charset.forName("UTF-8")), + new MappingJackson2HttpMessageConverter()) + ); + } + + @Override + protected void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/static/**") + .addResourceLocations("classpath:/static/"); + registry.addResourceHandler("doc.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + super.addResourceHandlers(registry); + } +} diff --git a/alive-commons/src/main/resources/banner.txt b/alive-commons/src/main/resources/banner.txt new file mode 100644 index 0000000..29ae600 --- /dev/null +++ b/alive-commons/src/main/resources/banner.txt @@ -0,0 +1,6 @@ + ____ _____ _____ _____ _ _ _____ _ _ + / __ \ | __ \ / ____| / ____| | | | | |_ _| | \ | | /\ +| | | | | | | | | | ______ | | | |__| | | | | \| | / \ +| | | | | | | | | | |______| | | | __ | | | | . ` | / /\ \ +| |__| | | |__| | | |____ | |____ | | | | _| |_ | |\ | / ____ \ + \____/ |_____/ \_____| \_____| |_| |_| |_____| |_| \_| /_/ \_\ \ No newline at end of file diff --git a/alive-commons/src/main/resources/logback-spring.xml b/alive-commons/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..835353f --- /dev/null +++ b/alive-commons/src/main/resources/logback-spring.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n + + + + + + warn + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n + + + + + + + ERROR + ACCEPT + DENY + + + + + ${log_dir}/%d{yyyy-MM-dd}-error.log + ${maxHistory} + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + + + + + + INFO + ACCEPT + DENY + + + ${log_dir}/%d{yyyy-MM-dd}-info.log + ${maxHistory} + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/alive-db/pom.xml b/alive-db/pom.xml new file mode 100644 index 0000000..e23655b --- /dev/null +++ b/alive-db/pom.xml @@ -0,0 +1,154 @@ + + + + alive-api-server + com.alive + 1.0-SNAPSHOT + + 4.0.0 + alive-db + jar + + + 1.8 + 3.12.3 + com.alive.db.jooq + jdbc:mysql://127.0.0.1:3306 + root + root + alive_dev + com.mysql.cj.jdbc.Driver + + + + + org.jooq + jooq + ${jooq.version} + + + + org.jooq + jooq-meta + ${jooq.version} + + + + org.jooq + jooq-codegen + ${jooq.version} + + + + org.projectlombok + lombok + true + + + + com.baomidou + mybatis-plus + 3.3.2 + + + + org.hibernate + hibernate-validator + 6.0.18.Final + + + + io.swagger + swagger-annotations + 1.6.1 + + + com.fasterxml.jackson.core + jackson-annotations + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + 8 + + + + org.jooq + jooq-codegen-maven + ${jooq.version} + + + mysql + mysql-connector-java + 8.0.18 + + + + + ${db.driver} + ${db.url}/${db.schema}?useSSL=false&serverTimezone=GMT + ${db.username} + ${db.password} + + + + org.jooq.meta.mysql.MySQLDatabase + + sys_account | + sys_action_log | + sys_config | + sys_menu | + sys_role | + t_member_sign | + t_uni_notice | + t_uni_banner | + node_buy_log | + t_member | + t_member_wallet | + t_member_wallet_log | + node | + node_award_setting | + node_setting | + node_task | + node_task_log | + activity_log | + activity_config | + activity_statistics | + chain_log | + coin_config | + pay_coin_log + + + a_template_table + + true + ${db.schema} + false + + + ${jooq.generate} + ${project.basedir}/src/main/java + + + false + true + + + com.alive.db.CustomJooqGeneratorStrategy + + + + + + + + \ No newline at end of file diff --git a/alive-db/readme.md b/alive-db/readme.md new file mode 100644 index 0000000..9e34589 --- /dev/null +++ b/alive-db/readme.md @@ -0,0 +1,7 @@ +## smt-db + +jooq 生成代码 + +### 参考文章 + +- [依赖顺序](https://stackoverflow.com/questions/55222589/how-to-fix-jooq-code-generation-tool-error) \ No newline at end of file diff --git a/alive-db/src/main/java/com/alive/db/CustomJooqGeneratorStrategy.java b/alive-db/src/main/java/com/alive/db/CustomJooqGeneratorStrategy.java new file mode 100644 index 0000000..919ba37 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/CustomJooqGeneratorStrategy.java @@ -0,0 +1,26 @@ +package com.alive.db; + +import org.jooq.codegen.DefaultGeneratorStrategy; +import org.jooq.meta.Definition; +import org.jooq.meta.TableDefinition; + +public class CustomJooqGeneratorStrategy extends DefaultGeneratorStrategy { + + @Override + public String getJavaClassName(Definition definition, Mode mode) { + String result = super.getJavaClassName(definition, mode); + switch (mode) { + case POJO: + result += "Pojo"; + break; + case DEFAULT: + if (definition instanceof TableDefinition) { + result += "Table"; + } + break; + default: + break; + } + return result; + } +} diff --git a/alive-db/src/main/java/com/alive/db/dto/MenuDTO.java b/alive-db/src/main/java/com/alive/db/dto/MenuDTO.java new file mode 100644 index 0000000..353f8ef --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/dto/MenuDTO.java @@ -0,0 +1,56 @@ +package com.alive.db.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +@Data +public class MenuDTO { + + private Integer id; + + @NotNull(message = "name不能为空") + @ApiModelProperty("菜单、按钮名") + private String name; + + private String label; + + @NotNull(message = "component不能为空") + @ApiModelProperty("前端组件地址") + private String component; + + @NotNull(message = "hidden不能为空") + @ApiModelProperty("0显示,1隐藏") + private boolean hidden; + + @NotNull(message = "icon不能为空") + @ApiModelProperty("图标") + private String icon; + + @ApiModelProperty("上级id") + private Integer parentId; + + @ApiModelProperty("子菜单") + private List children; + + private Integer childrenCount; + + @NotNull(message = "path不能为空") + @ApiModelProperty("组件地址") + private String path; + + public MenuMeta meta; + + @Data + public static class MenuMeta { + private String title; + private String icon; + } + + public Integer getChildrenCount() { + childrenCount = children != null ? children.size() : 0; + return childrenCount; + } +} diff --git a/alive-db/src/main/java/com/alive/db/dto/PermissionDTO.java b/alive-db/src/main/java/com/alive/db/dto/PermissionDTO.java new file mode 100644 index 0000000..25e01b3 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/dto/PermissionDTO.java @@ -0,0 +1,13 @@ +package com.alive.db.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PermissionDTO { + + private Integer id; + + @ApiModelProperty("需要的权限") + private String permission; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/BaseEntity.java b/alive-db/src/main/java/com/alive/db/entity/BaseEntity.java new file mode 100644 index 0000000..08bc65c --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/BaseEntity.java @@ -0,0 +1,25 @@ +package com.alive.db.entity; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; + +import java.sql.Timestamp; + +@Data +public abstract class BaseEntity { + + @TableId(type = IdType.AUTO) + private Integer id; + + private Timestamp createTime; + + //private String createBy; + + @TableField(updateStrategy = FieldStrategy.NEVER) + private Timestamp updateTime; + + //private String updateBy; + + @TableLogic(value = "1", delval = "0") + private Integer flag; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/MemberLeveEntity.java b/alive-db/src/main/java/com/alive/db/entity/MemberLeveEntity.java new file mode 100644 index 0000000..22c501f --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/MemberLeveEntity.java @@ -0,0 +1,22 @@ +package com.alive.db.entity; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class MemberLeveEntity { + private Integer memberId; + private Integer walletId; + + private BigDecimal totalAmount;//释放总数 + private String account; + private Integer accountType; + private Integer level; + private Integer referId; + private String allPid; + private Integer shareNum; + private Integer teamNum; + private String gameUid; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/NodeBuyLog.java b/alive-db/src/main/java/com/alive/db/entity/NodeBuyLog.java new file mode 100644 index 0000000..e5d33be --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/NodeBuyLog.java @@ -0,0 +1,146 @@ +package com.alive.db.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.math.BigInteger; + +/** + * 节点认购记录对象 node_buy_log + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NodeBuyLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + /** + * 钱包地址 + */ + private String walletAddress; + + /** + * 推荐人ID + */ + private Integer recommendId; + + /** + * 间推人ID + */ + private Integer indirectUserId; + + /** + * 认购数量 + */ + @ApiModelProperty("认购数量") + private Integer buyCount; + + /** + * 支付币种 + */ + @ApiModelProperty("支付币种") + private String payCoin; + + /** + * 认购金额 + */ + @ApiModelProperty("支付金额") + private BigDecimal buyAmount; + + @ApiModelProperty("上级地址") + private String address; + + /** + * 节点ID + */ + private Integer nodeSettingId; + + /** + * 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + private Integer status; + + /** + * 用户id + */ + private Integer userId; + + /** + * 交易hash + */ + @ApiModelProperty("交易hash") + private String hash; + + /** + * 订单号 + */ + @ApiModelProperty("订单号") + private String orderNumber; + + /** + * 出账地址 + */ + private String inputAddress; + + /** + * 到账地址 + */ + private String outAddress; + + /** + * 返佣金额 + */ + private BigDecimal rebate; + + private String teamAddress; + + + /** + * 购买盒子获取Rbit奖励数量 + */ + private BigDecimal rbitAmount; + + /** + * 1代Rbit奖励 + */ + private BigDecimal rbitOne; + + /** + * 2代Rbit奖励 + */ + private BigDecimal rbitTwo; + + /** + * 购买盒子NFT碎片奖励数量 + */ + private BigDecimal nftAmount; + + /** + * 1代NFT碎片奖励 + */ + private BigDecimal nftOne; + + /** + * 2代NFT碎片奖励 + */ + private BigDecimal nftTwo; + + /** + * 说明 + */ + private String illustrate; + + @ApiModelProperty("返佣比例") + private BigInteger rebateRatio; + + @ApiModelProperty("随机数") + private Integer num; + + private String nodeName; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/NodeNftConfig.java b/alive-db/src/main/java/com/alive/db/entity/NodeNftConfig.java new file mode 100644 index 0000000..ff29b00 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/NodeNftConfig.java @@ -0,0 +1,42 @@ +package com.alive.db.entity; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * NFT碎片配置对象 node_nft_config + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NodeNftConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** + * 1=注册 + */ + private Integer status; + + /** + * 区间开始数量 + */ + private Integer startNum; + + /** + * 区间结束数量 + */ + private Integer endNum; + + /** + * 奖励数量 + */ + private BigDecimal amount; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/NodePriceConfig.java b/alive-db/src/main/java/com/alive/db/entity/NodePriceConfig.java new file mode 100644 index 0000000..ee51e83 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/NodePriceConfig.java @@ -0,0 +1,42 @@ +package com.alive.db.entity; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 节点价格区间配置对象 node_price_config + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NodePriceConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** + * 节点配置id + */ + private Integer nodeSettingId; + + /** + * 区间开始数量 + */ + private Integer startNum; + + /** + * 区间结束数量 + */ + private Integer endNum; + + /** + * 价格 + */ + private BigDecimal price; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/NodeSetting.java b/alive-db/src/main/java/com/alive/db/entity/NodeSetting.java new file mode 100644 index 0000000..4cf896a --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/NodeSetting.java @@ -0,0 +1,93 @@ +package com.alive.db.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 节点设置对象 node_setting + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NodeSetting extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** + * 认购币种 + */ + @ApiModelProperty("认购币种") + private String buyCoinName; + + @ApiModelProperty("节点价格") + private BigDecimal nodePrice; + + /** + * 节点总量 + */ + @ApiModelProperty("节点总量") + private Integer nodeTotal; + + + /** + * 单地址限购数量 + */ + @ApiModelProperty("单地址限购数量") + private Integer purchaseLimit; + + /** + * 已购数量 + */ + @ApiModelProperty("已购数量") + private Integer purchasedCount; + + /** + * 已购金额 + */ + @ApiModelProperty("已购金额") + private BigDecimal purchasedAmount; + + /** + * 当前状态:1:认购中;2:已完成;3:待认购 + */ + @ApiModelProperty("1:认购中;2:已完成;3:待认购") + private Integer status; + + /** + * 节点名称 + */ + @ApiModelProperty("节点名称") + private String nodeName; + + /** + * 说明 + */ + @ApiModelProperty("说明") + private String illustrate; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("推荐NFT并获得 5% 的返利") + private BigDecimal rebateRatio; + + @ApiModelProperty("1级rbit奖励比例") + private BigDecimal rbitOne; + + @ApiModelProperty("1级NFT配件奖励比例") + private BigDecimal nftOne; + + @ApiModelProperty("2级rbit奖励比例") + private BigDecimal rebateTwo; + + @ApiModelProperty("2级NFT配件奖励比例") + private BigDecimal nftTwo; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/SysAccountEntity.java b/alive-db/src/main/java/com/alive/db/entity/SysAccountEntity.java new file mode 100644 index 0000000..0757ec2 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/SysAccountEntity.java @@ -0,0 +1,27 @@ +package com.alive.db.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@TableName(value = "sys_account") +@EqualsAndHashCode(callSuper = true) +public class SysAccountEntity extends BaseEntity { + + private String account; + + private String address; + + private String name; + + private String password; + + private Integer status; + + private Integer roleId; + + private String email; + + //private String readonly; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/SysMenuEntity.java b/alive-db/src/main/java/com/alive/db/entity/SysMenuEntity.java new file mode 100644 index 0000000..b495f15 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/SysMenuEntity.java @@ -0,0 +1,40 @@ +package com.alive.db.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@TableName(value = "sys_menu") +@EqualsAndHashCode(callSuper = true) +public class SysMenuEntity extends BaseEntity { + + //菜单名 + private String name; + + //前端组件地址 + private String component; + + //0显示,1隐藏 + private Boolean hidden; + + //图标 + private String icon; + + //上层id + private Integer parentId; + + private Integer level; + + @TableField(exist = false) + private String label; + + private String path; + @ApiModelProperty("子菜单") + @TableField(exist = false) + private List children; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/SysRoleEntity.java b/alive-db/src/main/java/com/alive/db/entity/SysRoleEntity.java new file mode 100644 index 0000000..30a44ce --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/SysRoleEntity.java @@ -0,0 +1,20 @@ +package com.alive.db.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@TableName(value = "sys_role") +@EqualsAndHashCode(callSuper = true) +public class SysRoleEntity extends BaseEntity { + + //权限名 + private String name; + + //权限列表,逗号分隔,sys_menu表id + private String permissions; + + //0禁用,1启用 + private Integer status; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityConfigVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityConfigVo.java new file mode 100644 index 0000000..f6fe44b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityConfigVo.java @@ -0,0 +1,51 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * 活动 + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class ActivityConfigVo +{ + + @ApiModelProperty("活动配置ID(做任务需要)") + private Integer id; + + @ApiModelProperty("活动标题") + private String title; + + @ApiModelProperty("活动内容") + private String titleContent; + + @ApiModelProperty("活动图片") + private String activityImg; + + @ApiModelProperty("活动跳转链接") + private String activityUrl; + + @ApiModelProperty("应奖励金额") + private String amount; + + @ApiModelProperty("实际奖励金额") + private String actualAmount; + + @ApiModelProperty("1=推特关注 2=推特转载 3=推特点赞 4=推特评论 5=推特改名 6=加入Discord 7=推荐 8=测试跨链桥 9=绑定邀请码") + private Integer type; + + @ApiModelProperty("1=进行中 2=已结束 3=已下架 4=链接钱包 5=已完成 6=任务中") + private Integer state; + + /** + * -1表示该任务每天只能做一次,1表示该任务每天可以做一次 + */ + private Integer activityNumber; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityOutcomeVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityOutcomeVo.java new file mode 100644 index 0000000..99e9be8 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityOutcomeVo.java @@ -0,0 +1,30 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class ActivityOutcomeVo +{ + @ApiModelProperty("活动列表") + private List activityConfigVos; + + @ApiModelProperty("参与用户数量") + private Integer usesNumber; + + @ApiModelProperty("是否提示绑定邀请码 0=未提示 1=已提示") + private Integer codePrompt; + + @ApiModelProperty("我赚取了多少ROS") + private String amount; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityTaskVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityTaskVo.java new file mode 100644 index 0000000..dcd03c1 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/ActivityTaskVo.java @@ -0,0 +1,26 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class ActivityTaskVo +{ + @ApiModelProperty("1=打开链接 2=提示绑定关系") + private Integer type; + + @ApiModelProperty("活动需要的链接") + private String activityUrl; + + @ApiModelProperty("授权链接") + private String authorizationLinks; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/InvitationCodeVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/InvitationCodeVo.java new file mode 100644 index 0000000..0b9c1ad --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/InvitationCodeVo.java @@ -0,0 +1,26 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class InvitationCodeVo +{ + private static final long serialVersionUID = 1L; + + /** + * 邀请码 + */ + @ApiModelProperty("邀请码") + private String invitationCode; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/InviteContributeVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteContributeVo.java new file mode 100644 index 0000000..e63d31d --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteContributeVo.java @@ -0,0 +1,31 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class InviteContributeVo +{ + @ApiModelProperty("用户名") + private String userName; + + @ApiModelProperty("用户地址") + private String address; + + @ApiModelProperty("头像") + private String userImg; + + @ApiModelProperty("邀请奖励") + private BigDecimal invitationRewards; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/InviteCountVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteCountVo.java new file mode 100644 index 0000000..51e0042 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteCountVo.java @@ -0,0 +1,33 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class InviteCountVo +{ + @ApiModelProperty("邀请码") + private String invitationCode; + + @ApiModelProperty("邀请人数") + private Integer userNumber; + + @ApiModelProperty("邀请奖励") + private BigDecimal invitationRewards; + + @ApiModelProperty("贡献列表") + private List inviteContributeVoList; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/InviteVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteVo.java new file mode 100644 index 0000000..a978e26 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/InviteVo.java @@ -0,0 +1,35 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class InviteVo +{ + private static final long serialVersionUID = 1L; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 是否购买 + */ + @ApiModelProperty("是否购买") + private Integer status; + + @ApiModelProperty("节点名称") + private String nodeName; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/MyIntegralVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/MyIntegralVo.java new file mode 100644 index 0000000..ae47d72 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/MyIntegralVo.java @@ -0,0 +1,24 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 用户推荐奖励 + */ +@Data +public class MyIntegralVo { + + @ApiModelProperty("我完成的") + private String iVeFinished; + + @ApiModelProperty("推荐完成的") + private String recommend; + + @ApiModelProperty("我的积分") + private String myIntegral; + + @ApiModelProperty("推荐获得积分") + private String recommendationPoints; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/NodeSettingVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/NodeSettingVo.java new file mode 100644 index 0000000..752c3bc --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/NodeSettingVo.java @@ -0,0 +1,38 @@ +package com.alive.db.entity.Vo; + +import com.alive.db.entity.BaseEntity; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 节点设置对象Vo + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NodeSettingVo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** + * 节点总量 + */ + private Integer nodeTotal; + + /** + * 已购数量 + */ + private BigDecimal purchasedCount; + + /** + * 节点价格 + */ + private BigDecimal price; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/NodeTaskVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/NodeTaskVo.java new file mode 100644 index 0000000..6021dca --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/NodeTaskVo.java @@ -0,0 +1,24 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class NodeTaskVo { + + @ApiModelProperty("数量") + private String number; + + @ApiModelProperty("类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分") + private Integer type; + + + @ApiModelProperty("0=未完成 1=待领取 2=已领取") + private Integer state; + + @ApiModelProperty("奖励币种") + private String coinName; + + @ApiModelProperty("领取奖励时参数ID") + private Integer id; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/NoticeOfPaymentVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/NoticeOfPaymentVo.java new file mode 100644 index 0000000..ec6cf05 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/NoticeOfPaymentVo.java @@ -0,0 +1,26 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class NoticeOfPaymentVo +{ + private static final long serialVersionUID = 1L; + + /** + * 状态 + */ + @ApiModelProperty("1=成功 0=失败") + private Integer type; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/PayCoinVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/PayCoinVo.java new file mode 100644 index 0000000..721477e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/PayCoinVo.java @@ -0,0 +1,29 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 用户众筹 + */ +@Data +@Accessors(chain = true) +public class PayCoinVo { + + @ApiModelProperty("订单号") + private String orderNumber; + + @ApiModelProperty("支付USDT金额") + private BigDecimal usdtAmount; + + private String address; + + /** + * -1=链上未确认 0=失败 1=成功 + */ + private Integer status; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/PrivatePlacementVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/PrivatePlacementVo.java new file mode 100644 index 0000000..3f92f66 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/PrivatePlacementVo.java @@ -0,0 +1,36 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 用户众筹 + */ +@Data +@Accessors(chain = true) +public class PrivatePlacementVo { + + @ApiModelProperty("币种") + private Integer coinId; + + @ApiModelProperty("USDT价格") + private String usdtPrice; + + @ApiModelProperty("最低私募数量") + private String minNumber; + + @ApiModelProperty("总私募金额") + private String privatePlacement; + + @ApiModelProperty("已私募数量") + private String toPrivatePlacement; + + @ApiModelProperty("我的私募数量") + private String wordPrivatePlacement; + + @ApiModelProperty("我的空投数量") + private String wordAirdrop; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/RankingSummaryVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/RankingSummaryVo.java new file mode 100644 index 0000000..cf74199 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/RankingSummaryVo.java @@ -0,0 +1,38 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class RankingSummaryVo +{ + @ApiModelProperty("上级邀请人") + private String superior; + + @ApiModelProperty("排名 ") + private Integer ranking; + + @ApiModelProperty("头像") + private String userImg; + + @ApiModelProperty("用户名") + private String userName; + + @ApiModelProperty("金额") + private String amount; + + @ApiModelProperty("排名列表") + private List rankingVos; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/RankingVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/RankingVo.java new file mode 100644 index 0000000..86a4c9f --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/RankingVo.java @@ -0,0 +1,35 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 排行 + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class RankingVo +{ + @ApiModelProperty("用户地址") + private String address; + + @ApiModelProperty("用户名") + private String userName; + + @ApiModelProperty("头像") + private String userImg; + + @ApiModelProperty("上级") + private String superior; + + @ApiModelProperty("金额") + private BigDecimal amount; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/RecommendVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/RecommendVo.java new file mode 100644 index 0000000..edc9214 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/RecommendVo.java @@ -0,0 +1,46 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * 用户推荐奖励 + */ +@Data +@Accessors(chain = true) +public class RecommendVo { + + @ApiModelProperty("邀请码") + private String invitationCode; + + @ApiModelProperty("返利比例") + private String rebate; + + @ApiModelProperty("1级获得BRIT比例") + private String oneBrit; + + @ApiModelProperty("1级获得NFT") + private String oneNft; + + @ApiModelProperty("2级获得BRIT比例") + private String twoBrit; + + @ApiModelProperty("2级获得NFT") + private String twoNft; + + @ApiModelProperty("1代NFT获得数量") + private String oneNftAmount; + + @ApiModelProperty("2代NFT获得数量") + private String twoNftAmount; + + @ApiModelProperty("BIT积分获取数量") + private String bitAmount; + + @ApiModelProperty("USDT获得数量") + private String usdtAmount; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/TaskVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/TaskVo.java new file mode 100644 index 0000000..ad03380 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/TaskVo.java @@ -0,0 +1,17 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class TaskVo { + + @ApiModelProperty("地址") + private String address; + + @ApiModelProperty("数量") + private String number; + + @ApiModelProperty("类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分") + private Integer type; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/TeamRewardVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/TeamRewardVo.java new file mode 100644 index 0000000..6c51041 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/TeamRewardVo.java @@ -0,0 +1,15 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class TeamRewardVo { + + @ApiModelProperty("地址") + private String address; + + @ApiModelProperty("数量") + private String number; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/TransactionDataVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/TransactionDataVo.java new file mode 100644 index 0000000..56942b3 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/TransactionDataVo.java @@ -0,0 +1,53 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + + +/** + * 用户交易的数据 + */ +@Data +@Accessors(chain = true) +public class TransactionDataVo { + + /** + * 支付地址,用户地址 + */ + private String from; + + /** + * 支付金额 + */ + private BigDecimal payAmount; + + /** + * NFT铸造数量 + */ + private Integer nftNumber; + + /** + * -1=链上未确认 0=失败 1=成功 + */ + private Integer status; + + /** + * NFT全部ID列表 + */ + private List nftIds; + + /** + * 上级地址 + */ + private String teamAddress; + + /** + * 上级奖励金额 + */ + private BigDecimal teamAmount; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/UserInviteVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/UserInviteVo.java new file mode 100644 index 0000000..ea5bc4f --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/UserInviteVo.java @@ -0,0 +1,40 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class UserInviteVo +{ + private static final long serialVersionUID = 1L; + + /** + * 邀请数量 + */ + @ApiModelProperty("邀请数量") + private Integer userNumber; + + /** + * 贡献 + */ + @ApiModelProperty("贡献") + private BigDecimal contribution; + + /** + * 奖励NFT + */ + @ApiModelProperty("奖励NFT") + private BigDecimal nftNumer; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/UserTeamVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/UserTeamVo.java new file mode 100644 index 0000000..4ac7bed --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/UserTeamVo.java @@ -0,0 +1,25 @@ + +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * @author HayDen + * @date 2024-05-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class UserTeamVo +{ + @ApiModelProperty("上级账户") + private String account; + + @ApiModelProperty("上级账户Id") + private Integer id; +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/UserVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/UserVo.java new file mode 100644 index 0000000..decf053 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/UserVo.java @@ -0,0 +1,15 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class UserVo { + + @NotNull + @ApiModelProperty("加密串") + private String encryptedString; + +} diff --git a/alive-db/src/main/java/com/alive/db/entity/Vo/WordNodeVo.java b/alive-db/src/main/java/com/alive/db/entity/Vo/WordNodeVo.java new file mode 100644 index 0000000..1762467 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/entity/Vo/WordNodeVo.java @@ -0,0 +1,48 @@ +package com.alive.db.entity.Vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * + * @author HayDen + * @date 2024-01-09 + */ +@Setter +@Getter +@Accessors(chain = true) +public class WordNodeVo +{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("节点编号") + private Integer id; + + @ApiModelProperty("节点等级") + private String nodeGrade; + + @ApiModelProperty("支付金额") + private BigDecimal buyAmount; + + @ApiModelProperty("节点名称") + private String nodeName; + + @ApiModelProperty("说明") + private String illustrate; + + @ApiModelProperty("1=显示盒子 2=支付确认中 3=提示用户去购买盒子") + private Integer status; + + //购买盒子时间 + private String createTime; + + /** + * 特殊的奖励金额 + * 修改日期为2024-04-30晚上20:17 产品需求确认以前购买盒子的显示一个38000的数值,后续的显示为0 + */ + private String specialAmount; +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/DefaultCatalog.java b/alive-db/src/main/java/com/alive/db/jooq/DefaultCatalog.java new file mode 100644 index 0000000..58f73a6 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/DefaultCatalog.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + + +/** + * This class is generated by jOOQ. + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DefaultCatalog extends CatalogImpl { + + private static final long serialVersionUID = 1223604634; + + /** + * The reference instance of + */ + public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); + + /** + * The schema . + */ + public final DefaultSchema DEFAULT_SCHEMA = com.alive.db.jooq.DefaultSchema.DEFAULT_SCHEMA; + + /** + * No further instances allowed + */ + private DefaultCatalog() { + super(""); + } + + @Override + public final List getSchemas() { + List result = new ArrayList(); + result.addAll(getSchemas0()); + return result; + } + + private final List getSchemas0() { + return Arrays.asList( + DefaultSchema.DEFAULT_SCHEMA); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/DefaultSchema.java b/alive-db/src/main/java/com/alive/db/jooq/DefaultSchema.java new file mode 100644 index 0000000..2af6fd9 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/DefaultSchema.java @@ -0,0 +1,223 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq; + + +import com.alive.db.jooq.tables.ActivityConfigTable; +import com.alive.db.jooq.tables.ActivityLogTable; +import com.alive.db.jooq.tables.ActivityStatisticsTable; +import com.alive.db.jooq.tables.ChainLogTable; +import com.alive.db.jooq.tables.CoinConfigTable; +import com.alive.db.jooq.tables.NodeAwardSettingTable; +import com.alive.db.jooq.tables.NodeBuyLogTable; +import com.alive.db.jooq.tables.NodeSettingTable; +import com.alive.db.jooq.tables.NodeTable; +import com.alive.db.jooq.tables.NodeTaskLogTable; +import com.alive.db.jooq.tables.NodeTaskTable; +import com.alive.db.jooq.tables.PayCoinLogTable; +import com.alive.db.jooq.tables.SysAccountTable; +import com.alive.db.jooq.tables.SysActionLogTable; +import com.alive.db.jooq.tables.SysConfigTable; +import com.alive.db.jooq.tables.SysMenuTable; +import com.alive.db.jooq.tables.SysRoleTable; +import com.alive.db.jooq.tables.TMemberSignTable; +import com.alive.db.jooq.tables.TMemberTable; +import com.alive.db.jooq.tables.TMemberWalletLogTable; +import com.alive.db.jooq.tables.TMemberWalletTable; +import com.alive.db.jooq.tables.TUniBannerTable; +import com.alive.db.jooq.tables.TUniNoticeTable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; + + +/** + * This class is generated by jOOQ. + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DefaultSchema extends SchemaImpl { + + private static final long serialVersionUID = 1266626571; + + /** + * The reference instance of + */ + public static final DefaultSchema DEFAULT_SCHEMA = new DefaultSchema(); + + /** + * 活动配置 + */ + public final ActivityConfigTable ACTIVITY_CONFIG = com.alive.db.jooq.tables.ActivityConfigTable.ACTIVITY_CONFIG; + + /** + * 活动任务日志 + */ + public final ActivityLogTable ACTIVITY_LOG = com.alive.db.jooq.tables.ActivityLogTable.ACTIVITY_LOG; + + /** + * 业绩统计 + */ + public final ActivityStatisticsTable ACTIVITY_STATISTICS = com.alive.db.jooq.tables.ActivityStatisticsTable.ACTIVITY_STATISTICS; + + /** + * 链日志同步 + */ + public final ChainLogTable CHAIN_LOG = com.alive.db.jooq.tables.ChainLogTable.CHAIN_LOG; + + /** + * 币种配置表 + */ + public final CoinConfigTable COIN_CONFIG = com.alive.db.jooq.tables.CoinConfigTable.COIN_CONFIG; + + /** + * 用户节点表 + */ + public final NodeTable NODE = com.alive.db.jooq.tables.NodeTable.NODE; + + /** + * 节点奖励设置 + */ + public final NodeAwardSettingTable NODE_AWARD_SETTING = com.alive.db.jooq.tables.NodeAwardSettingTable.NODE_AWARD_SETTING; + + /** + * 节点认购记录 + */ + public final NodeBuyLogTable NODE_BUY_LOG = com.alive.db.jooq.tables.NodeBuyLogTable.NODE_BUY_LOG; + + /** + * 节点设置 + */ + public final NodeSettingTable NODE_SETTING = com.alive.db.jooq.tables.NodeSettingTable.NODE_SETTING; + + /** + * NEER任务配置 + */ + public final NodeTaskTable NODE_TASK = com.alive.db.jooq.tables.NodeTaskTable.NODE_TASK; + + /** + * 我的任务奖励 + */ + public final NodeTaskLogTable NODE_TASK_LOG = com.alive.db.jooq.tables.NodeTaskLogTable.NODE_TASK_LOG; + + /** + * 兑换币种日志表 + */ + public final PayCoinLogTable PAY_COIN_LOG = com.alive.db.jooq.tables.PayCoinLogTable.PAY_COIN_LOG; + + /** + * 系统账户 + */ + public final SysAccountTable SYS_ACCOUNT = com.alive.db.jooq.tables.SysAccountTable.SYS_ACCOUNT; + + /** + * 系统操作日志 + */ + public final SysActionLogTable SYS_ACTION_LOG = com.alive.db.jooq.tables.SysActionLogTable.SYS_ACTION_LOG; + + /** + * 一些配置 + */ + public final SysConfigTable SYS_CONFIG = com.alive.db.jooq.tables.SysConfigTable.SYS_CONFIG; + + /** + * 菜单权限表 + */ + public final SysMenuTable SYS_MENU = com.alive.db.jooq.tables.SysMenuTable.SYS_MENU; + + /** + * 角色信息表 + */ + public final SysRoleTable SYS_ROLE = com.alive.db.jooq.tables.SysRoleTable.SYS_ROLE; + + /** + * 用户 + */ + public final TMemberTable T_MEMBER = com.alive.db.jooq.tables.TMemberTable.T_MEMBER; + + /** + * 用户签名交易对 + */ + public final TMemberSignTable T_MEMBER_SIGN = com.alive.db.jooq.tables.TMemberSignTable.T_MEMBER_SIGN; + + /** + * 资产 + */ + public final TMemberWalletTable T_MEMBER_WALLET = com.alive.db.jooq.tables.TMemberWalletTable.T_MEMBER_WALLET; + + /** + * 资产流水 + */ + public final TMemberWalletLogTable T_MEMBER_WALLET_LOG = com.alive.db.jooq.tables.TMemberWalletLogTable.T_MEMBER_WALLET_LOG; + + /** + * Banner + */ + public final TUniBannerTable T_UNI_BANNER = com.alive.db.jooq.tables.TUniBannerTable.T_UNI_BANNER; + + /** + * 公告 + */ + public final TUniNoticeTable T_UNI_NOTICE = com.alive.db.jooq.tables.TUniNoticeTable.T_UNI_NOTICE; + + /** + * No further instances allowed + */ + private DefaultSchema() { + super("", null); + } + + + @Override + public Catalog getCatalog() { + return DefaultCatalog.DEFAULT_CATALOG; + } + + @Override + public final List> getTables() { + List result = new ArrayList(); + result.addAll(getTables0()); + return result; + } + + private final List> getTables0() { + return Arrays.>asList( + ActivityConfigTable.ACTIVITY_CONFIG, + ActivityLogTable.ACTIVITY_LOG, + ActivityStatisticsTable.ACTIVITY_STATISTICS, + ChainLogTable.CHAIN_LOG, + CoinConfigTable.COIN_CONFIG, + NodeTable.NODE, + NodeAwardSettingTable.NODE_AWARD_SETTING, + NodeBuyLogTable.NODE_BUY_LOG, + NodeSettingTable.NODE_SETTING, + NodeTaskTable.NODE_TASK, + NodeTaskLogTable.NODE_TASK_LOG, + PayCoinLogTable.PAY_COIN_LOG, + SysAccountTable.SYS_ACCOUNT, + SysActionLogTable.SYS_ACTION_LOG, + SysConfigTable.SYS_CONFIG, + SysMenuTable.SYS_MENU, + SysRoleTable.SYS_ROLE, + TMemberTable.T_MEMBER, + TMemberSignTable.T_MEMBER_SIGN, + TMemberWalletTable.T_MEMBER_WALLET, + TMemberWalletLogTable.T_MEMBER_WALLET_LOG, + TUniBannerTable.T_UNI_BANNER, + TUniNoticeTable.T_UNI_NOTICE); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/Indexes.java b/alive-db/src/main/java/com/alive/db/jooq/Indexes.java new file mode 100644 index 0000000..cdd7e30 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/Indexes.java @@ -0,0 +1,118 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq; + + +import com.alive.db.jooq.tables.ActivityConfigTable; +import com.alive.db.jooq.tables.ActivityLogTable; +import com.alive.db.jooq.tables.ActivityStatisticsTable; +import com.alive.db.jooq.tables.ChainLogTable; +import com.alive.db.jooq.tables.CoinConfigTable; +import com.alive.db.jooq.tables.NodeAwardSettingTable; +import com.alive.db.jooq.tables.NodeBuyLogTable; +import com.alive.db.jooq.tables.NodeSettingTable; +import com.alive.db.jooq.tables.NodeTable; +import com.alive.db.jooq.tables.NodeTaskLogTable; +import com.alive.db.jooq.tables.NodeTaskTable; +import com.alive.db.jooq.tables.PayCoinLogTable; +import com.alive.db.jooq.tables.SysAccountTable; +import com.alive.db.jooq.tables.SysActionLogTable; +import com.alive.db.jooq.tables.SysConfigTable; +import com.alive.db.jooq.tables.SysMenuTable; +import com.alive.db.jooq.tables.SysRoleTable; +import com.alive.db.jooq.tables.TMemberSignTable; +import com.alive.db.jooq.tables.TMemberTable; +import com.alive.db.jooq.tables.TMemberWalletLogTable; +import com.alive.db.jooq.tables.TMemberWalletTable; +import com.alive.db.jooq.tables.TUniBannerTable; +import com.alive.db.jooq.tables.TUniNoticeTable; + +import javax.annotation.Generated; + +import org.jooq.Index; +import org.jooq.OrderField; +import org.jooq.impl.Internal; + + +/** + * A class modelling indexes of tables of the schema. + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Indexes { + + // ------------------------------------------------------------------------- + // INDEX definitions + // ------------------------------------------------------------------------- + + public static final Index ACTIVITY_CONFIG_PRIMARY = Indexes0.ACTIVITY_CONFIG_PRIMARY; + public static final Index ACTIVITY_LOG_PRIMARY = Indexes0.ACTIVITY_LOG_PRIMARY; + public static final Index ACTIVITY_STATISTICS_ADDRESS_INDEX = Indexes0.ACTIVITY_STATISTICS_ADDRESS_INDEX; + public static final Index ACTIVITY_STATISTICS_PRIMARY = Indexes0.ACTIVITY_STATISTICS_PRIMARY; + public static final Index CHAIN_LOG_PRIMARY = Indexes0.CHAIN_LOG_PRIMARY; + public static final Index COIN_CONFIG_PRIMARY = Indexes0.COIN_CONFIG_PRIMARY; + public static final Index NODE_PRIMARY = Indexes0.NODE_PRIMARY; + public static final Index NODE_AWARD_SETTING_PRIMARY = Indexes0.NODE_AWARD_SETTING_PRIMARY; + public static final Index NODE_BUY_LOG_PRIMARY = Indexes0.NODE_BUY_LOG_PRIMARY; + public static final Index NODE_SETTING_PRIMARY = Indexes0.NODE_SETTING_PRIMARY; + public static final Index NODE_TASK_PRIMARY = Indexes0.NODE_TASK_PRIMARY; + public static final Index NODE_TASK_LOG_PRIMARY = Indexes0.NODE_TASK_LOG_PRIMARY; + public static final Index PAY_COIN_LOG_PRIMARY = Indexes0.PAY_COIN_LOG_PRIMARY; + public static final Index SYS_ACCOUNT_PRIMARY = Indexes0.SYS_ACCOUNT_PRIMARY; + public static final Index SYS_ACTION_LOG_PRIMARY = Indexes0.SYS_ACTION_LOG_PRIMARY; + public static final Index SYS_CONFIG_PRIMARY = Indexes0.SYS_CONFIG_PRIMARY; + public static final Index SYS_MENU_PRIMARY = Indexes0.SYS_MENU_PRIMARY; + public static final Index SYS_ROLE_PRIMARY = Indexes0.SYS_ROLE_PRIMARY; + public static final Index T_MEMBER_PRIMARY = Indexes0.T_MEMBER_PRIMARY; + public static final Index T_MEMBER_SIGN_PRIMARY = Indexes0.T_MEMBER_SIGN_PRIMARY; + public static final Index T_MEMBER_WALLET_IDX_MID = Indexes0.T_MEMBER_WALLET_IDX_MID; + public static final Index T_MEMBER_WALLET_PRIMARY = Indexes0.T_MEMBER_WALLET_PRIMARY; + public static final Index T_MEMBER_WALLET_LOG_IDX_MID = Indexes0.T_MEMBER_WALLET_LOG_IDX_MID; + public static final Index T_MEMBER_WALLET_LOG_IDX_WALLET_TYPE = Indexes0.T_MEMBER_WALLET_LOG_IDX_WALLET_TYPE; + public static final Index T_MEMBER_WALLET_LOG_IDX_WID = Indexes0.T_MEMBER_WALLET_LOG_IDX_WID; + public static final Index T_MEMBER_WALLET_LOG_PRIMARY = Indexes0.T_MEMBER_WALLET_LOG_PRIMARY; + public static final Index T_UNI_BANNER_PRIMARY = Indexes0.T_UNI_BANNER_PRIMARY; + public static final Index T_UNI_NOTICE_PRIMARY = Indexes0.T_UNI_NOTICE_PRIMARY; + + // ------------------------------------------------------------------------- + // [#1459] distribute members to avoid static initialisers > 64kb + // ------------------------------------------------------------------------- + + private static class Indexes0 { + public static Index ACTIVITY_CONFIG_PRIMARY = Internal.createIndex("PRIMARY", ActivityConfigTable.ACTIVITY_CONFIG, new OrderField[] { ActivityConfigTable.ACTIVITY_CONFIG.ID }, true); + public static Index ACTIVITY_LOG_PRIMARY = Internal.createIndex("PRIMARY", ActivityLogTable.ACTIVITY_LOG, new OrderField[] { ActivityLogTable.ACTIVITY_LOG.ID }, true); + public static Index ACTIVITY_STATISTICS_ADDRESS_INDEX = Internal.createIndex("address_index", ActivityStatisticsTable.ACTIVITY_STATISTICS, new OrderField[] { ActivityStatisticsTable.ACTIVITY_STATISTICS.ADDRESS }, false); + public static Index ACTIVITY_STATISTICS_PRIMARY = Internal.createIndex("PRIMARY", ActivityStatisticsTable.ACTIVITY_STATISTICS, new OrderField[] { ActivityStatisticsTable.ACTIVITY_STATISTICS.ID }, true); + public static Index CHAIN_LOG_PRIMARY = Internal.createIndex("PRIMARY", ChainLogTable.CHAIN_LOG, new OrderField[] { ChainLogTable.CHAIN_LOG.ID }, true); + public static Index COIN_CONFIG_PRIMARY = Internal.createIndex("PRIMARY", CoinConfigTable.COIN_CONFIG, new OrderField[] { CoinConfigTable.COIN_CONFIG.ID }, true); + public static Index NODE_PRIMARY = Internal.createIndex("PRIMARY", NodeTable.NODE, new OrderField[] { NodeTable.NODE.ID }, true); + public static Index NODE_AWARD_SETTING_PRIMARY = Internal.createIndex("PRIMARY", NodeAwardSettingTable.NODE_AWARD_SETTING, new OrderField[] { NodeAwardSettingTable.NODE_AWARD_SETTING.ID }, true); + public static Index NODE_BUY_LOG_PRIMARY = Internal.createIndex("PRIMARY", NodeBuyLogTable.NODE_BUY_LOG, new OrderField[] { NodeBuyLogTable.NODE_BUY_LOG.ID }, true); + public static Index NODE_SETTING_PRIMARY = Internal.createIndex("PRIMARY", NodeSettingTable.NODE_SETTING, new OrderField[] { NodeSettingTable.NODE_SETTING.ID }, true); + public static Index NODE_TASK_PRIMARY = Internal.createIndex("PRIMARY", NodeTaskTable.NODE_TASK, new OrderField[] { NodeTaskTable.NODE_TASK.ID }, true); + public static Index NODE_TASK_LOG_PRIMARY = Internal.createIndex("PRIMARY", NodeTaskLogTable.NODE_TASK_LOG, new OrderField[] { NodeTaskLogTable.NODE_TASK_LOG.ID }, true); + public static Index PAY_COIN_LOG_PRIMARY = Internal.createIndex("PRIMARY", PayCoinLogTable.PAY_COIN_LOG, new OrderField[] { PayCoinLogTable.PAY_COIN_LOG.ID }, true); + public static Index SYS_ACCOUNT_PRIMARY = Internal.createIndex("PRIMARY", SysAccountTable.SYS_ACCOUNT, new OrderField[] { SysAccountTable.SYS_ACCOUNT.ID }, true); + public static Index SYS_ACTION_LOG_PRIMARY = Internal.createIndex("PRIMARY", SysActionLogTable.SYS_ACTION_LOG, new OrderField[] { SysActionLogTable.SYS_ACTION_LOG.ID }, true); + public static Index SYS_CONFIG_PRIMARY = Internal.createIndex("PRIMARY", SysConfigTable.SYS_CONFIG, new OrderField[] { SysConfigTable.SYS_CONFIG.ID }, true); + public static Index SYS_MENU_PRIMARY = Internal.createIndex("PRIMARY", SysMenuTable.SYS_MENU, new OrderField[] { SysMenuTable.SYS_MENU.MENU_ID }, true); + public static Index SYS_ROLE_PRIMARY = Internal.createIndex("PRIMARY", SysRoleTable.SYS_ROLE, new OrderField[] { SysRoleTable.SYS_ROLE.ROLE_ID }, true); + public static Index T_MEMBER_PRIMARY = Internal.createIndex("PRIMARY", TMemberTable.T_MEMBER, new OrderField[] { TMemberTable.T_MEMBER.ID }, true); + public static Index T_MEMBER_SIGN_PRIMARY = Internal.createIndex("PRIMARY", TMemberSignTable.T_MEMBER_SIGN, new OrderField[] { TMemberSignTable.T_MEMBER_SIGN.ID }, true); + public static Index T_MEMBER_WALLET_IDX_MID = Internal.createIndex("idx_mid", TMemberWalletTable.T_MEMBER_WALLET, new OrderField[] { TMemberWalletTable.T_MEMBER_WALLET.MEMBER_ID }, false); + public static Index T_MEMBER_WALLET_PRIMARY = Internal.createIndex("PRIMARY", TMemberWalletTable.T_MEMBER_WALLET, new OrderField[] { TMemberWalletTable.T_MEMBER_WALLET.ID }, true); + public static Index T_MEMBER_WALLET_LOG_IDX_MID = Internal.createIndex("idx_mid", TMemberWalletLogTable.T_MEMBER_WALLET_LOG, new OrderField[] { TMemberWalletLogTable.T_MEMBER_WALLET_LOG.MEMBER_ID }, false); + public static Index T_MEMBER_WALLET_LOG_IDX_WALLET_TYPE = Internal.createIndex("idx_wallet_type", TMemberWalletLogTable.T_MEMBER_WALLET_LOG, new OrderField[] { TMemberWalletLogTable.T_MEMBER_WALLET_LOG.COIN_ID }, false); + public static Index T_MEMBER_WALLET_LOG_IDX_WID = Internal.createIndex("idx_wid", TMemberWalletLogTable.T_MEMBER_WALLET_LOG, new OrderField[] { TMemberWalletLogTable.T_MEMBER_WALLET_LOG.WALLET_ID }, false); + public static Index T_MEMBER_WALLET_LOG_PRIMARY = Internal.createIndex("PRIMARY", TMemberWalletLogTable.T_MEMBER_WALLET_LOG, new OrderField[] { TMemberWalletLogTable.T_MEMBER_WALLET_LOG.ID }, true); + public static Index T_UNI_BANNER_PRIMARY = Internal.createIndex("PRIMARY", TUniBannerTable.T_UNI_BANNER, new OrderField[] { TUniBannerTable.T_UNI_BANNER.ID }, true); + public static Index T_UNI_NOTICE_PRIMARY = Internal.createIndex("PRIMARY", TUniNoticeTable.T_UNI_NOTICE, new OrderField[] { TUniNoticeTable.T_UNI_NOTICE.ID }, true); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/Keys.java b/alive-db/src/main/java/com/alive/db/jooq/Keys.java new file mode 100644 index 0000000..8920f4b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/Keys.java @@ -0,0 +1,191 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq; + + +import com.alive.db.jooq.tables.ActivityConfigTable; +import com.alive.db.jooq.tables.ActivityLogTable; +import com.alive.db.jooq.tables.ActivityStatisticsTable; +import com.alive.db.jooq.tables.ChainLogTable; +import com.alive.db.jooq.tables.CoinConfigTable; +import com.alive.db.jooq.tables.NodeAwardSettingTable; +import com.alive.db.jooq.tables.NodeBuyLogTable; +import com.alive.db.jooq.tables.NodeSettingTable; +import com.alive.db.jooq.tables.NodeTable; +import com.alive.db.jooq.tables.NodeTaskLogTable; +import com.alive.db.jooq.tables.NodeTaskTable; +import com.alive.db.jooq.tables.PayCoinLogTable; +import com.alive.db.jooq.tables.SysAccountTable; +import com.alive.db.jooq.tables.SysActionLogTable; +import com.alive.db.jooq.tables.SysConfigTable; +import com.alive.db.jooq.tables.SysMenuTable; +import com.alive.db.jooq.tables.SysRoleTable; +import com.alive.db.jooq.tables.TMemberSignTable; +import com.alive.db.jooq.tables.TMemberTable; +import com.alive.db.jooq.tables.TMemberWalletLogTable; +import com.alive.db.jooq.tables.TMemberWalletTable; +import com.alive.db.jooq.tables.TUniBannerTable; +import com.alive.db.jooq.tables.TUniNoticeTable; +import com.alive.db.jooq.tables.records.ActivityConfigRecord; +import com.alive.db.jooq.tables.records.ActivityLogRecord; +import com.alive.db.jooq.tables.records.ActivityStatisticsRecord; +import com.alive.db.jooq.tables.records.ChainLogRecord; +import com.alive.db.jooq.tables.records.CoinConfigRecord; +import com.alive.db.jooq.tables.records.NodeAwardSettingRecord; +import com.alive.db.jooq.tables.records.NodeBuyLogRecord; +import com.alive.db.jooq.tables.records.NodeRecord; +import com.alive.db.jooq.tables.records.NodeSettingRecord; +import com.alive.db.jooq.tables.records.NodeTaskLogRecord; +import com.alive.db.jooq.tables.records.NodeTaskRecord; +import com.alive.db.jooq.tables.records.PayCoinLogRecord; +import com.alive.db.jooq.tables.records.SysAccountRecord; +import com.alive.db.jooq.tables.records.SysActionLogRecord; +import com.alive.db.jooq.tables.records.SysConfigRecord; +import com.alive.db.jooq.tables.records.SysMenuRecord; +import com.alive.db.jooq.tables.records.SysRoleRecord; +import com.alive.db.jooq.tables.records.TMemberRecord; +import com.alive.db.jooq.tables.records.TMemberSignRecord; +import com.alive.db.jooq.tables.records.TMemberWalletLogRecord; +import com.alive.db.jooq.tables.records.TMemberWalletRecord; +import com.alive.db.jooq.tables.records.TUniBannerRecord; +import com.alive.db.jooq.tables.records.TUniNoticeRecord; + +import javax.annotation.Generated; + +import org.jooq.Identity; +import org.jooq.UniqueKey; +import org.jooq.impl.Internal; + + +/** + * A class modelling foreign key relationships and constraints of tables of + * the schema. + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Keys { + + // ------------------------------------------------------------------------- + // IDENTITY definitions + // ------------------------------------------------------------------------- + + public static final Identity IDENTITY_ACTIVITY_CONFIG = Identities0.IDENTITY_ACTIVITY_CONFIG; + public static final Identity IDENTITY_ACTIVITY_LOG = Identities0.IDENTITY_ACTIVITY_LOG; + public static final Identity IDENTITY_ACTIVITY_STATISTICS = Identities0.IDENTITY_ACTIVITY_STATISTICS; + public static final Identity IDENTITY_CHAIN_LOG = Identities0.IDENTITY_CHAIN_LOG; + public static final Identity IDENTITY_COIN_CONFIG = Identities0.IDENTITY_COIN_CONFIG; + public static final Identity IDENTITY_NODE = Identities0.IDENTITY_NODE; + public static final Identity IDENTITY_NODE_AWARD_SETTING = Identities0.IDENTITY_NODE_AWARD_SETTING; + public static final Identity IDENTITY_NODE_BUY_LOG = Identities0.IDENTITY_NODE_BUY_LOG; + public static final Identity IDENTITY_NODE_SETTING = Identities0.IDENTITY_NODE_SETTING; + public static final Identity IDENTITY_NODE_TASK = Identities0.IDENTITY_NODE_TASK; + public static final Identity IDENTITY_NODE_TASK_LOG = Identities0.IDENTITY_NODE_TASK_LOG; + public static final Identity IDENTITY_PAY_COIN_LOG = Identities0.IDENTITY_PAY_COIN_LOG; + public static final Identity IDENTITY_SYS_ACCOUNT = Identities0.IDENTITY_SYS_ACCOUNT; + public static final Identity IDENTITY_SYS_ACTION_LOG = Identities0.IDENTITY_SYS_ACTION_LOG; + public static final Identity IDENTITY_SYS_CONFIG = Identities0.IDENTITY_SYS_CONFIG; + public static final Identity IDENTITY_SYS_MENU = Identities0.IDENTITY_SYS_MENU; + public static final Identity IDENTITY_SYS_ROLE = Identities0.IDENTITY_SYS_ROLE; + public static final Identity IDENTITY_T_MEMBER = Identities0.IDENTITY_T_MEMBER; + public static final Identity IDENTITY_T_MEMBER_SIGN = Identities0.IDENTITY_T_MEMBER_SIGN; + public static final Identity IDENTITY_T_MEMBER_WALLET = Identities0.IDENTITY_T_MEMBER_WALLET; + public static final Identity IDENTITY_T_MEMBER_WALLET_LOG = Identities0.IDENTITY_T_MEMBER_WALLET_LOG; + public static final Identity IDENTITY_T_UNI_BANNER = Identities0.IDENTITY_T_UNI_BANNER; + public static final Identity IDENTITY_T_UNI_NOTICE = Identities0.IDENTITY_T_UNI_NOTICE; + + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- + + public static final UniqueKey KEY_ACTIVITY_CONFIG_PRIMARY = UniqueKeys0.KEY_ACTIVITY_CONFIG_PRIMARY; + public static final UniqueKey KEY_ACTIVITY_LOG_PRIMARY = UniqueKeys0.KEY_ACTIVITY_LOG_PRIMARY; + public static final UniqueKey KEY_ACTIVITY_STATISTICS_PRIMARY = UniqueKeys0.KEY_ACTIVITY_STATISTICS_PRIMARY; + public static final UniqueKey KEY_CHAIN_LOG_PRIMARY = UniqueKeys0.KEY_CHAIN_LOG_PRIMARY; + public static final UniqueKey KEY_COIN_CONFIG_PRIMARY = UniqueKeys0.KEY_COIN_CONFIG_PRIMARY; + public static final UniqueKey KEY_NODE_PRIMARY = UniqueKeys0.KEY_NODE_PRIMARY; + public static final UniqueKey KEY_NODE_AWARD_SETTING_PRIMARY = UniqueKeys0.KEY_NODE_AWARD_SETTING_PRIMARY; + public static final UniqueKey KEY_NODE_BUY_LOG_PRIMARY = UniqueKeys0.KEY_NODE_BUY_LOG_PRIMARY; + public static final UniqueKey KEY_NODE_SETTING_PRIMARY = UniqueKeys0.KEY_NODE_SETTING_PRIMARY; + public static final UniqueKey KEY_NODE_TASK_PRIMARY = UniqueKeys0.KEY_NODE_TASK_PRIMARY; + public static final UniqueKey KEY_NODE_TASK_LOG_PRIMARY = UniqueKeys0.KEY_NODE_TASK_LOG_PRIMARY; + public static final UniqueKey KEY_PAY_COIN_LOG_PRIMARY = UniqueKeys0.KEY_PAY_COIN_LOG_PRIMARY; + public static final UniqueKey KEY_SYS_ACCOUNT_PRIMARY = UniqueKeys0.KEY_SYS_ACCOUNT_PRIMARY; + public static final UniqueKey KEY_SYS_ACTION_LOG_PRIMARY = UniqueKeys0.KEY_SYS_ACTION_LOG_PRIMARY; + public static final UniqueKey KEY_SYS_CONFIG_PRIMARY = UniqueKeys0.KEY_SYS_CONFIG_PRIMARY; + public static final UniqueKey KEY_SYS_MENU_PRIMARY = UniqueKeys0.KEY_SYS_MENU_PRIMARY; + public static final UniqueKey KEY_SYS_ROLE_PRIMARY = UniqueKeys0.KEY_SYS_ROLE_PRIMARY; + public static final UniqueKey KEY_T_MEMBER_PRIMARY = UniqueKeys0.KEY_T_MEMBER_PRIMARY; + public static final UniqueKey KEY_T_MEMBER_SIGN_PRIMARY = UniqueKeys0.KEY_T_MEMBER_SIGN_PRIMARY; + public static final UniqueKey KEY_T_MEMBER_WALLET_PRIMARY = UniqueKeys0.KEY_T_MEMBER_WALLET_PRIMARY; + public static final UniqueKey KEY_T_MEMBER_WALLET_LOG_PRIMARY = UniqueKeys0.KEY_T_MEMBER_WALLET_LOG_PRIMARY; + public static final UniqueKey KEY_T_UNI_BANNER_PRIMARY = UniqueKeys0.KEY_T_UNI_BANNER_PRIMARY; + public static final UniqueKey KEY_T_UNI_NOTICE_PRIMARY = UniqueKeys0.KEY_T_UNI_NOTICE_PRIMARY; + + // ------------------------------------------------------------------------- + // FOREIGN KEY definitions + // ------------------------------------------------------------------------- + + + // ------------------------------------------------------------------------- + // [#1459] distribute members to avoid static initialisers > 64kb + // ------------------------------------------------------------------------- + + private static class Identities0 { + public static Identity IDENTITY_ACTIVITY_CONFIG = Internal.createIdentity(ActivityConfigTable.ACTIVITY_CONFIG, ActivityConfigTable.ACTIVITY_CONFIG.ID); + public static Identity IDENTITY_ACTIVITY_LOG = Internal.createIdentity(ActivityLogTable.ACTIVITY_LOG, ActivityLogTable.ACTIVITY_LOG.ID); + public static Identity IDENTITY_ACTIVITY_STATISTICS = Internal.createIdentity(ActivityStatisticsTable.ACTIVITY_STATISTICS, ActivityStatisticsTable.ACTIVITY_STATISTICS.ID); + public static Identity IDENTITY_CHAIN_LOG = Internal.createIdentity(ChainLogTable.CHAIN_LOG, ChainLogTable.CHAIN_LOG.ID); + public static Identity IDENTITY_COIN_CONFIG = Internal.createIdentity(CoinConfigTable.COIN_CONFIG, CoinConfigTable.COIN_CONFIG.ID); + public static Identity IDENTITY_NODE = Internal.createIdentity(NodeTable.NODE, NodeTable.NODE.ID); + public static Identity IDENTITY_NODE_AWARD_SETTING = Internal.createIdentity(NodeAwardSettingTable.NODE_AWARD_SETTING, NodeAwardSettingTable.NODE_AWARD_SETTING.ID); + public static Identity IDENTITY_NODE_BUY_LOG = Internal.createIdentity(NodeBuyLogTable.NODE_BUY_LOG, NodeBuyLogTable.NODE_BUY_LOG.ID); + public static Identity IDENTITY_NODE_SETTING = Internal.createIdentity(NodeSettingTable.NODE_SETTING, NodeSettingTable.NODE_SETTING.ID); + public static Identity IDENTITY_NODE_TASK = Internal.createIdentity(NodeTaskTable.NODE_TASK, NodeTaskTable.NODE_TASK.ID); + public static Identity IDENTITY_NODE_TASK_LOG = Internal.createIdentity(NodeTaskLogTable.NODE_TASK_LOG, NodeTaskLogTable.NODE_TASK_LOG.ID); + public static Identity IDENTITY_PAY_COIN_LOG = Internal.createIdentity(PayCoinLogTable.PAY_COIN_LOG, PayCoinLogTable.PAY_COIN_LOG.ID); + public static Identity IDENTITY_SYS_ACCOUNT = Internal.createIdentity(SysAccountTable.SYS_ACCOUNT, SysAccountTable.SYS_ACCOUNT.ID); + public static Identity IDENTITY_SYS_ACTION_LOG = Internal.createIdentity(SysActionLogTable.SYS_ACTION_LOG, SysActionLogTable.SYS_ACTION_LOG.ID); + public static Identity IDENTITY_SYS_CONFIG = Internal.createIdentity(SysConfigTable.SYS_CONFIG, SysConfigTable.SYS_CONFIG.ID); + public static Identity IDENTITY_SYS_MENU = Internal.createIdentity(SysMenuTable.SYS_MENU, SysMenuTable.SYS_MENU.MENU_ID); + public static Identity IDENTITY_SYS_ROLE = Internal.createIdentity(SysRoleTable.SYS_ROLE, SysRoleTable.SYS_ROLE.ROLE_ID); + public static Identity IDENTITY_T_MEMBER = Internal.createIdentity(TMemberTable.T_MEMBER, TMemberTable.T_MEMBER.ID); + public static Identity IDENTITY_T_MEMBER_SIGN = Internal.createIdentity(TMemberSignTable.T_MEMBER_SIGN, TMemberSignTable.T_MEMBER_SIGN.ID); + public static Identity IDENTITY_T_MEMBER_WALLET = Internal.createIdentity(TMemberWalletTable.T_MEMBER_WALLET, TMemberWalletTable.T_MEMBER_WALLET.ID); + public static Identity IDENTITY_T_MEMBER_WALLET_LOG = Internal.createIdentity(TMemberWalletLogTable.T_MEMBER_WALLET_LOG, TMemberWalletLogTable.T_MEMBER_WALLET_LOG.ID); + public static Identity IDENTITY_T_UNI_BANNER = Internal.createIdentity(TUniBannerTable.T_UNI_BANNER, TUniBannerTable.T_UNI_BANNER.ID); + public static Identity IDENTITY_T_UNI_NOTICE = Internal.createIdentity(TUniNoticeTable.T_UNI_NOTICE, TUniNoticeTable.T_UNI_NOTICE.ID); + } + + private static class UniqueKeys0 { + public static final UniqueKey KEY_ACTIVITY_CONFIG_PRIMARY = Internal.createUniqueKey(ActivityConfigTable.ACTIVITY_CONFIG, "KEY_activity_config_PRIMARY", ActivityConfigTable.ACTIVITY_CONFIG.ID); + public static final UniqueKey KEY_ACTIVITY_LOG_PRIMARY = Internal.createUniqueKey(ActivityLogTable.ACTIVITY_LOG, "KEY_activity_log_PRIMARY", ActivityLogTable.ACTIVITY_LOG.ID); + public static final UniqueKey KEY_ACTIVITY_STATISTICS_PRIMARY = Internal.createUniqueKey(ActivityStatisticsTable.ACTIVITY_STATISTICS, "KEY_activity_statistics_PRIMARY", ActivityStatisticsTable.ACTIVITY_STATISTICS.ID); + public static final UniqueKey KEY_CHAIN_LOG_PRIMARY = Internal.createUniqueKey(ChainLogTable.CHAIN_LOG, "KEY_chain_log_PRIMARY", ChainLogTable.CHAIN_LOG.ID); + public static final UniqueKey KEY_COIN_CONFIG_PRIMARY = Internal.createUniqueKey(CoinConfigTable.COIN_CONFIG, "KEY_coin_config_PRIMARY", CoinConfigTable.COIN_CONFIG.ID); + public static final UniqueKey KEY_NODE_PRIMARY = Internal.createUniqueKey(NodeTable.NODE, "KEY_node_PRIMARY", NodeTable.NODE.ID); + public static final UniqueKey KEY_NODE_AWARD_SETTING_PRIMARY = Internal.createUniqueKey(NodeAwardSettingTable.NODE_AWARD_SETTING, "KEY_node_award_setting_PRIMARY", NodeAwardSettingTable.NODE_AWARD_SETTING.ID); + public static final UniqueKey KEY_NODE_BUY_LOG_PRIMARY = Internal.createUniqueKey(NodeBuyLogTable.NODE_BUY_LOG, "KEY_node_buy_log_PRIMARY", NodeBuyLogTable.NODE_BUY_LOG.ID); + public static final UniqueKey KEY_NODE_SETTING_PRIMARY = Internal.createUniqueKey(NodeSettingTable.NODE_SETTING, "KEY_node_setting_PRIMARY", NodeSettingTable.NODE_SETTING.ID); + public static final UniqueKey KEY_NODE_TASK_PRIMARY = Internal.createUniqueKey(NodeTaskTable.NODE_TASK, "KEY_node_task_PRIMARY", NodeTaskTable.NODE_TASK.ID); + public static final UniqueKey KEY_NODE_TASK_LOG_PRIMARY = Internal.createUniqueKey(NodeTaskLogTable.NODE_TASK_LOG, "KEY_node_task_log_PRIMARY", NodeTaskLogTable.NODE_TASK_LOG.ID); + public static final UniqueKey KEY_PAY_COIN_LOG_PRIMARY = Internal.createUniqueKey(PayCoinLogTable.PAY_COIN_LOG, "KEY_pay_coin_log_PRIMARY", PayCoinLogTable.PAY_COIN_LOG.ID); + public static final UniqueKey KEY_SYS_ACCOUNT_PRIMARY = Internal.createUniqueKey(SysAccountTable.SYS_ACCOUNT, "KEY_sys_account_PRIMARY", SysAccountTable.SYS_ACCOUNT.ID); + public static final UniqueKey KEY_SYS_ACTION_LOG_PRIMARY = Internal.createUniqueKey(SysActionLogTable.SYS_ACTION_LOG, "KEY_sys_action_log_PRIMARY", SysActionLogTable.SYS_ACTION_LOG.ID); + public static final UniqueKey KEY_SYS_CONFIG_PRIMARY = Internal.createUniqueKey(SysConfigTable.SYS_CONFIG, "KEY_sys_config_PRIMARY", SysConfigTable.SYS_CONFIG.ID); + public static final UniqueKey KEY_SYS_MENU_PRIMARY = Internal.createUniqueKey(SysMenuTable.SYS_MENU, "KEY_sys_menu_PRIMARY", SysMenuTable.SYS_MENU.MENU_ID); + public static final UniqueKey KEY_SYS_ROLE_PRIMARY = Internal.createUniqueKey(SysRoleTable.SYS_ROLE, "KEY_sys_role_PRIMARY", SysRoleTable.SYS_ROLE.ROLE_ID); + public static final UniqueKey KEY_T_MEMBER_PRIMARY = Internal.createUniqueKey(TMemberTable.T_MEMBER, "KEY_t_member_PRIMARY", TMemberTable.T_MEMBER.ID); + public static final UniqueKey KEY_T_MEMBER_SIGN_PRIMARY = Internal.createUniqueKey(TMemberSignTable.T_MEMBER_SIGN, "KEY_t_member_sign_PRIMARY", TMemberSignTable.T_MEMBER_SIGN.ID); + public static final UniqueKey KEY_T_MEMBER_WALLET_PRIMARY = Internal.createUniqueKey(TMemberWalletTable.T_MEMBER_WALLET, "KEY_t_member_wallet_PRIMARY", TMemberWalletTable.T_MEMBER_WALLET.ID); + public static final UniqueKey KEY_T_MEMBER_WALLET_LOG_PRIMARY = Internal.createUniqueKey(TMemberWalletLogTable.T_MEMBER_WALLET_LOG, "KEY_t_member_wallet_log_PRIMARY", TMemberWalletLogTable.T_MEMBER_WALLET_LOG.ID); + public static final UniqueKey KEY_T_UNI_BANNER_PRIMARY = Internal.createUniqueKey(TUniBannerTable.T_UNI_BANNER, "KEY_t_uni_banner_PRIMARY", TUniBannerTable.T_UNI_BANNER.ID); + public static final UniqueKey KEY_T_UNI_NOTICE_PRIMARY = Internal.createUniqueKey(TUniNoticeTable.T_UNI_NOTICE, "KEY_t_uni_notice_PRIMARY", TUniNoticeTable.T_UNI_NOTICE.ID); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/Tables.java b/alive-db/src/main/java/com/alive/db/jooq/Tables.java new file mode 100644 index 0000000..dd94897 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/Tables.java @@ -0,0 +1,161 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq; + + +import com.alive.db.jooq.tables.ActivityConfigTable; +import com.alive.db.jooq.tables.ActivityLogTable; +import com.alive.db.jooq.tables.ActivityStatisticsTable; +import com.alive.db.jooq.tables.ChainLogTable; +import com.alive.db.jooq.tables.CoinConfigTable; +import com.alive.db.jooq.tables.NodeAwardSettingTable; +import com.alive.db.jooq.tables.NodeBuyLogTable; +import com.alive.db.jooq.tables.NodeSettingTable; +import com.alive.db.jooq.tables.NodeTable; +import com.alive.db.jooq.tables.NodeTaskLogTable; +import com.alive.db.jooq.tables.NodeTaskTable; +import com.alive.db.jooq.tables.PayCoinLogTable; +import com.alive.db.jooq.tables.SysAccountTable; +import com.alive.db.jooq.tables.SysActionLogTable; +import com.alive.db.jooq.tables.SysConfigTable; +import com.alive.db.jooq.tables.SysMenuTable; +import com.alive.db.jooq.tables.SysRoleTable; +import com.alive.db.jooq.tables.TMemberSignTable; +import com.alive.db.jooq.tables.TMemberTable; +import com.alive.db.jooq.tables.TMemberWalletLogTable; +import com.alive.db.jooq.tables.TMemberWalletTable; +import com.alive.db.jooq.tables.TUniBannerTable; +import com.alive.db.jooq.tables.TUniNoticeTable; + +import javax.annotation.Generated; + + +/** + * Convenience access to all tables in + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Tables { + + /** + * 活动配置 + */ + public static final ActivityConfigTable ACTIVITY_CONFIG = ActivityConfigTable.ACTIVITY_CONFIG; + + /** + * 活动任务日志 + */ + public static final ActivityLogTable ACTIVITY_LOG = ActivityLogTable.ACTIVITY_LOG; + + /** + * 业绩统计 + */ + public static final ActivityStatisticsTable ACTIVITY_STATISTICS = ActivityStatisticsTable.ACTIVITY_STATISTICS; + + /** + * 链日志同步 + */ + public static final ChainLogTable CHAIN_LOG = ChainLogTable.CHAIN_LOG; + + /** + * 币种配置表 + */ + public static final CoinConfigTable COIN_CONFIG = CoinConfigTable.COIN_CONFIG; + + /** + * 用户节点表 + */ + public static final NodeTable NODE = NodeTable.NODE; + + /** + * 节点奖励设置 + */ + public static final NodeAwardSettingTable NODE_AWARD_SETTING = NodeAwardSettingTable.NODE_AWARD_SETTING; + + /** + * 节点认购记录 + */ + public static final NodeBuyLogTable NODE_BUY_LOG = NodeBuyLogTable.NODE_BUY_LOG; + + /** + * 节点设置 + */ + public static final NodeSettingTable NODE_SETTING = NodeSettingTable.NODE_SETTING; + + /** + * NEER任务配置 + */ + public static final NodeTaskTable NODE_TASK = NodeTaskTable.NODE_TASK; + + /** + * 我的任务奖励 + */ + public static final NodeTaskLogTable NODE_TASK_LOG = NodeTaskLogTable.NODE_TASK_LOG; + + /** + * 兑换币种日志表 + */ + public static final PayCoinLogTable PAY_COIN_LOG = PayCoinLogTable.PAY_COIN_LOG; + + /** + * 系统账户 + */ + public static final SysAccountTable SYS_ACCOUNT = SysAccountTable.SYS_ACCOUNT; + + /** + * 系统操作日志 + */ + public static final SysActionLogTable SYS_ACTION_LOG = SysActionLogTable.SYS_ACTION_LOG; + + /** + * 一些配置 + */ + public static final SysConfigTable SYS_CONFIG = SysConfigTable.SYS_CONFIG; + + /** + * 菜单权限表 + */ + public static final SysMenuTable SYS_MENU = SysMenuTable.SYS_MENU; + + /** + * 角色信息表 + */ + public static final SysRoleTable SYS_ROLE = SysRoleTable.SYS_ROLE; + + /** + * 用户 + */ + public static final TMemberTable T_MEMBER = TMemberTable.T_MEMBER; + + /** + * 用户签名交易对 + */ + public static final TMemberSignTable T_MEMBER_SIGN = TMemberSignTable.T_MEMBER_SIGN; + + /** + * 资产 + */ + public static final TMemberWalletTable T_MEMBER_WALLET = TMemberWalletTable.T_MEMBER_WALLET; + + /** + * 资产流水 + */ + public static final TMemberWalletLogTable T_MEMBER_WALLET_LOG = TMemberWalletLogTable.T_MEMBER_WALLET_LOG; + + /** + * Banner + */ + public static final TUniBannerTable T_UNI_BANNER = TUniBannerTable.T_UNI_BANNER; + + /** + * 公告 + */ + public static final TUniNoticeTable T_UNI_NOTICE = TUniNoticeTable.T_UNI_NOTICE; +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityConfigTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityConfigTable.java new file mode 100644 index 0000000..05dfc14 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityConfigTable.java @@ -0,0 +1,229 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.ActivityConfigRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row15; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 活动配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityConfigTable extends TableImpl { + + private static final long serialVersionUID = -1717856274; + + /** + * The reference instance of activity_config + */ + public static final ActivityConfigTable ACTIVITY_CONFIG = new ActivityConfigTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityConfigRecord.class; + } + + /** + * The column activity_config.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column activity_config.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column activity_config.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column activity_config.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column activity_config.title. 活动标题 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "活动标题"); + + /** + * The column activity_config.title_content. 活动内容 + */ + public final TableField TITLE_CONTENT = createField(DSL.name("title_content"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "活动内容"); + + /** + * The column activity_config.activity_img. 活动图片 + */ + public final TableField ACTIVITY_IMG = createField(DSL.name("activity_img"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "活动图片"); + + /** + * The column activity_config.activity_url. 活动跳转链接 + */ + public final TableField ACTIVITY_URL = createField(DSL.name("activity_url"), org.jooq.impl.SQLDataType.VARCHAR(500).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "活动跳转链接"); + + /** + * The column activity_config.state. 1=进行中 2=已结束 3=已下架 + */ + public final TableField STATE = createField(DSL.name("state"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "1=进行中 2=已结束 3=已下架"); + + /** + * The column activity_config.amount. 奖励金额 + */ + public final TableField AMOUNT = createField(DSL.name("amount"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "奖励金额"); + + /** + * The column activity_config.superior_amount. 上级奖励金额 + */ + public final TableField SUPERIOR_AMOUNT = createField(DSL.name("superior_amount"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "上级奖励金额"); + + /** + * The column activity_config.activity_number. 每天可以做的次数(每天1次) -1表示任务是一次性的 + */ + public final TableField ACTIVITY_NUMBER = createField(DSL.name("activity_number"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "每天可以做的次数(每天1次) -1表示任务是一次性的"); + + /** + * The column activity_config.category. 1=社交媒体活动 2=测试网络活动 + */ + public final TableField CATEGORY = createField(DSL.name("category"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "1=社交媒体活动 2=测试网络活动 "); + + /** + * The column activity_config.type. 1=推特关注 2=推特转载 3=推特点赞 4=推特评论 5=推特改名 6=加入Discord 7=推荐 8=测试跨链桥 9=绑定邀请码 10=加入TG + */ + public final TableField TYPE = createField(DSL.name("type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "1=推特关注 2=推特转载 3=推特点赞 4=推特评论 5=推特改名 6=加入Discord 7=推荐 8=测试跨链桥 9=绑定邀请码 10=加入TG"); + + /** + * The column activity_config.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public final TableField MARK = createField(DSL.name("mark"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.VARCHAR)), this, "(关注的推特名)(评论、转载、点赞的推文ID、改名的后缀)"); + + /** + * Create a activity_config table reference + */ + public ActivityConfigTable() { + this(DSL.name("activity_config"), null); + } + + /** + * Create an aliased activity_config table reference + */ + public ActivityConfigTable(String alias) { + this(DSL.name(alias), ACTIVITY_CONFIG); + } + + /** + * Create an aliased activity_config table reference + */ + public ActivityConfigTable(Name alias) { + this(alias, ACTIVITY_CONFIG); + } + + private ActivityConfigTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private ActivityConfigTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("活动配置")); + } + + public ActivityConfigTable(Table child, ForeignKey key) { + super(child, key, ACTIVITY_CONFIG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.ACTIVITY_CONFIG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_ACTIVITY_CONFIG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ACTIVITY_CONFIG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ACTIVITY_CONFIG_PRIMARY); + } + + @Override + public ActivityConfigTable as(String alias) { + return new ActivityConfigTable(DSL.name(alias), this); + } + + @Override + public ActivityConfigTable as(Name alias) { + return new ActivityConfigTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public ActivityConfigTable rename(String name) { + return new ActivityConfigTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ActivityConfigTable rename(Name name) { + return new ActivityConfigTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row15 type methods + // ------------------------------------------------------------------------- + + @Override + public Row15 fieldsRow() { + return (Row15) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityLogTable.java new file mode 100644 index 0000000..96adcef --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityLogTable.java @@ -0,0 +1,234 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.ActivityLogRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row16; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 活动任务日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityLogTable extends TableImpl { + + private static final long serialVersionUID = -363574502; + + /** + * The reference instance of activity_log + */ + public static final ActivityLogTable ACTIVITY_LOG = new ActivityLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityLogRecord.class; + } + + /** + * The column activity_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column activity_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column activity_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column activity_log.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column activity_log.activity_config_id. 配置ID + */ + public final TableField ACTIVITY_CONFIG_ID = createField(DSL.name("activity_config_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "配置ID"); + + /** + * The column activity_log.address. 用户地址 + */ + public final TableField ADDRESS = createField(DSL.name("address"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "用户地址"); + + /** + * The column activity_log.superior_address. 上级地址 + */ + public final TableField SUPERIOR_ADDRESS = createField(DSL.name("superior_address"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "上级地址"); + + /** + * The column activity_log.title. 活动标题 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "活动标题"); + + /** + * The column activity_log.type. 1=发起任务 2=已完成 3=失败 + */ + public final TableField TYPE = createField(DSL.name("type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "1=发起任务 2=已完成 3=失败"); + + /** + * The column activity_log.amount. 奖励金额 + */ + public final TableField AMOUNT = createField(DSL.name("amount"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "奖励金额"); + + /** + * The column activity_log.superior_amount. 上级奖励金额 + */ + public final TableField SUPERIOR_AMOUNT = createField(DSL.name("superior_amount"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "上级奖励金额"); + + /** + * The column activity_log.end_time. 任务结束时间 + */ + public final TableField END_TIME = createField(DSL.name("end_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "任务结束时间"); + + /** + * The column activity_log.config_type. 配置的TYPE + */ + public final TableField CONFIG_TYPE = createField(DSL.name("config_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "配置的TYPE"); + + /** + * The column activity_log.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public final TableField MARK = createField(DSL.name("mark"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.VARCHAR)), this, "(关注的推特名)(评论、转载、点赞的推文ID、改名的后缀)"); + + /** + * The column activity_log.hashs. 转账hash,多笔中间用逗号分隔 + */ + public final TableField HASHS = createField(DSL.name("hashs"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "转账hash,多笔中间用逗号分隔"); + + /** + * The column activity_log.transfer_type. 0:未执行链上发放 1:已链上发放 + */ + public final TableField TRANSFER_TYPE = createField(DSL.name("transfer_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "0:未执行链上发放 1:已链上发放"); + + /** + * Create a activity_log table reference + */ + public ActivityLogTable() { + this(DSL.name("activity_log"), null); + } + + /** + * Create an aliased activity_log table reference + */ + public ActivityLogTable(String alias) { + this(DSL.name(alias), ACTIVITY_LOG); + } + + /** + * Create an aliased activity_log table reference + */ + public ActivityLogTable(Name alias) { + this(alias, ACTIVITY_LOG); + } + + private ActivityLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private ActivityLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("活动任务日志")); + } + + public ActivityLogTable(Table child, ForeignKey key) { + super(child, key, ACTIVITY_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.ACTIVITY_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_ACTIVITY_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ACTIVITY_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ACTIVITY_LOG_PRIMARY); + } + + @Override + public ActivityLogTable as(String alias) { + return new ActivityLogTable(DSL.name(alias), this); + } + + @Override + public ActivityLogTable as(Name alias) { + return new ActivityLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public ActivityLogTable rename(String name) { + return new ActivityLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ActivityLogTable rename(Name name) { + return new ActivityLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row16 type methods + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityStatisticsTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityStatisticsTable.java new file mode 100644 index 0000000..6d12521 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/ActivityStatisticsTable.java @@ -0,0 +1,184 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.ActivityStatisticsRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row6; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 业绩统计 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityStatisticsTable extends TableImpl { + + private static final long serialVersionUID = -1903264628; + + /** + * The reference instance of activity_statistics + */ + public static final ActivityStatisticsTable ACTIVITY_STATISTICS = new ActivityStatisticsTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityStatisticsRecord.class; + } + + /** + * The column activity_statistics.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column activity_statistics.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column activity_statistics.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column activity_statistics.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column activity_statistics.address. 用户地址 + */ + public final TableField ADDRESS = createField(DSL.name("address"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "用户地址"); + + /** + * The column activity_statistics.amount. 累计业绩 + */ + public final TableField AMOUNT = createField(DSL.name("amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "累计业绩"); + + /** + * Create a activity_statistics table reference + */ + public ActivityStatisticsTable() { + this(DSL.name("activity_statistics"), null); + } + + /** + * Create an aliased activity_statistics table reference + */ + public ActivityStatisticsTable(String alias) { + this(DSL.name(alias), ACTIVITY_STATISTICS); + } + + /** + * Create an aliased activity_statistics table reference + */ + public ActivityStatisticsTable(Name alias) { + this(alias, ACTIVITY_STATISTICS); + } + + private ActivityStatisticsTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private ActivityStatisticsTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("业绩统计")); + } + + public ActivityStatisticsTable(Table child, ForeignKey key) { + super(child, key, ACTIVITY_STATISTICS); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.ACTIVITY_STATISTICS_ADDRESS_INDEX, Indexes.ACTIVITY_STATISTICS_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_ACTIVITY_STATISTICS; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ACTIVITY_STATISTICS_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ACTIVITY_STATISTICS_PRIMARY); + } + + @Override + public ActivityStatisticsTable as(String alias) { + return new ActivityStatisticsTable(DSL.name(alias), this); + } + + @Override + public ActivityStatisticsTable as(Name alias) { + return new ActivityStatisticsTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public ActivityStatisticsTable rename(String name) { + return new ActivityStatisticsTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ActivityStatisticsTable rename(Name name) { + return new ActivityStatisticsTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row6 type methods + // ------------------------------------------------------------------------- + + @Override + public Row6 fieldsRow() { + return (Row6) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/ChainLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/ChainLogTable.java new file mode 100644 index 0000000..437f1c8 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/ChainLogTable.java @@ -0,0 +1,198 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.ChainLogRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row9; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 链日志同步 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ChainLogTable extends TableImpl { + + private static final long serialVersionUID = -1201347895; + + /** + * The reference instance of chain_log + */ + public static final ChainLogTable CHAIN_LOG = new ChainLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ChainLogRecord.class; + } + + /** + * The column chain_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column chain_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column chain_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column chain_log.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column chain_log.block_number. 区块号 + */ + public final TableField BLOCK_NUMBER = createField(DSL.name("block_number"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "区块号"); + + /** + * The column chain_log.hash. 区块Hash + */ + public final TableField HASH = createField(DSL.name("hash"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "区块Hash"); + + /** + * The column chain_log.chain_name. 事件名称 + */ + public final TableField CHAIN_NAME = createField(DSL.name("chain_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "事件名称"); + + /** + * The column chain_log.data_value. 事件内容 + */ + public final TableField DATA_VALUE = createField(DSL.name("data_value"), org.jooq.impl.SQLDataType.CLOB, this, "事件内容"); + + /** + * The column chain_log.transaction_hash. 交易hash + */ + public final TableField TRANSACTION_HASH = createField(DSL.name("transaction_hash"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "交易hash"); + + /** + * Create a chain_log table reference + */ + public ChainLogTable() { + this(DSL.name("chain_log"), null); + } + + /** + * Create an aliased chain_log table reference + */ + public ChainLogTable(String alias) { + this(DSL.name(alias), CHAIN_LOG); + } + + /** + * Create an aliased chain_log table reference + */ + public ChainLogTable(Name alias) { + this(alias, CHAIN_LOG); + } + + private ChainLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private ChainLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("链日志同步")); + } + + public ChainLogTable(Table child, ForeignKey key) { + super(child, key, CHAIN_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.CHAIN_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_CHAIN_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_CHAIN_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_CHAIN_LOG_PRIMARY); + } + + @Override + public ChainLogTable as(String alias) { + return new ChainLogTable(DSL.name(alias), this); + } + + @Override + public ChainLogTable as(Name alias) { + return new ChainLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public ChainLogTable rename(String name) { + return new ChainLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public ChainLogTable rename(Name name) { + return new ChainLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row9 type methods + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/CoinConfigTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/CoinConfigTable.java new file mode 100644 index 0000000..dd74e6c --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/CoinConfigTable.java @@ -0,0 +1,214 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.CoinConfigRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row12; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 币种配置表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class CoinConfigTable extends TableImpl { + + private static final long serialVersionUID = -927118395; + + /** + * The reference instance of coin_config + */ + public static final CoinConfigTable COIN_CONFIG = new CoinConfigTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return CoinConfigRecord.class; + } + + /** + * The column coin_config.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column coin_config.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column coin_config.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column coin_config.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column coin_config.coin_name. 币种名称 + */ + public final TableField COIN_NAME = createField(DSL.name("coin_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "币种名称"); + + /** + * The column coin_config.state. 1=认购中 2=已下架 + */ + public final TableField STATE = createField(DSL.name("state"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "1=认购中 2=已下架"); + + /** + * The column coin_config.usdt_price. USDT 价格 + */ + public final TableField USDT_PRICE = createField(DSL.name("usdt_price"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "USDT 价格"); + + /** + * The column coin_config.min_number. 最低认购数量 + */ + public final TableField MIN_NUMBER = createField(DSL.name("min_number"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "最低认购数量"); + + /** + * The column coin_config.max_number. 最高认购数量 + */ + public final TableField MAX_NUMBER = createField(DSL.name("max_number"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "最高认购数量"); + + /** + * The column coin_config.airdrop_number. 空投数量 + */ + public final TableField AIRDROP_NUMBER = createField(DSL.name("airdrop_number"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false), this, "空投数量"); + + /** + * The column coin_config.private_placement. 私募总金额 + */ + public final TableField PRIVATE_PLACEMENT = createField(DSL.name("private_placement"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false), this, "私募总金额"); + + /** + * The column coin_config.to_private_placement. 已消耗私募金额 + */ + public final TableField TO_PRIVATE_PLACEMENT = createField(DSL.name("to_private_placement"), org.jooq.impl.SQLDataType.DECIMAL(20, 6).nullable(false), this, "已消耗私募金额"); + + /** + * Create a coin_config table reference + */ + public CoinConfigTable() { + this(DSL.name("coin_config"), null); + } + + /** + * Create an aliased coin_config table reference + */ + public CoinConfigTable(String alias) { + this(DSL.name(alias), COIN_CONFIG); + } + + /** + * Create an aliased coin_config table reference + */ + public CoinConfigTable(Name alias) { + this(alias, COIN_CONFIG); + } + + private CoinConfigTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private CoinConfigTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("币种配置表")); + } + + public CoinConfigTable(Table child, ForeignKey key) { + super(child, key, COIN_CONFIG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.COIN_CONFIG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_COIN_CONFIG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_COIN_CONFIG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_COIN_CONFIG_PRIMARY); + } + + @Override + public CoinConfigTable as(String alias) { + return new CoinConfigTable(DSL.name(alias), this); + } + + @Override + public CoinConfigTable as(Name alias) { + return new CoinConfigTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public CoinConfigTable rename(String name) { + return new CoinConfigTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public CoinConfigTable rename(Name name) { + return new CoinConfigTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row12 type methods + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeAwardSettingTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeAwardSettingTable.java new file mode 100644 index 0000000..a2416e7 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeAwardSettingTable.java @@ -0,0 +1,219 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeAwardSettingRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row13; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 节点奖励设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeAwardSettingTable extends TableImpl { + + private static final long serialVersionUID = -781204966; + + /** + * The reference instance of node_award_setting + */ + public static final NodeAwardSettingTable NODE_AWARD_SETTING = new NodeAwardSettingTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeAwardSettingRecord.class; + } + + /** + * The column node_award_setting.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node_award_setting.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node_award_setting.create_by. 创建人 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "创建人"); + + /** + * The column node_award_setting.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node_award_setting.update_by. 更新人 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "更新人"); + + /** + * The column node_award_setting.node_setting_id. 节点奖励id + */ + public final TableField NODE_SETTING_ID = createField(DSL.name("node_setting_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "节点奖励id"); + + /** + * The column node_award_setting.rebate. 返佣比例 + */ + public final TableField REBATE = createField(DSL.name("rebate"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "返佣比例"); + + /** + * The column node_award_setting.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public final TableField RBIT_AMOUNT = createField(DSL.name("rbit_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false), this, "购买盒子获取Rbit奖励数量"); + + /** + * The column node_award_setting.rbit_one. 1代Rbit奖励比例 + */ + public final TableField RBIT_ONE = createField(DSL.name("rbit_one"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "1代Rbit奖励比例"); + + /** + * The column node_award_setting.rebate_two. 2代Rbit奖励比例 + */ + public final TableField REBATE_TWO = createField(DSL.name("rebate_two"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "2代Rbit奖励比例"); + + /** + * The column node_award_setting.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public final TableField NFT_AMOUNT = createField(DSL.name("nft_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "购买盒子NFT碎片奖励数量"); + + /** + * The column node_award_setting.nft_one. 1代NFT碎片奖励比例 + */ + public final TableField NFT_ONE = createField(DSL.name("nft_one"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "1代NFT碎片奖励比例"); + + /** + * The column node_award_setting.nft_two. 2代NFT碎片奖励比例 + */ + public final TableField NFT_TWO = createField(DSL.name("nft_two"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "2代NFT碎片奖励比例"); + + /** + * Create a node_award_setting table reference + */ + public NodeAwardSettingTable() { + this(DSL.name("node_award_setting"), null); + } + + /** + * Create an aliased node_award_setting table reference + */ + public NodeAwardSettingTable(String alias) { + this(DSL.name(alias), NODE_AWARD_SETTING); + } + + /** + * Create an aliased node_award_setting table reference + */ + public NodeAwardSettingTable(Name alias) { + this(alias, NODE_AWARD_SETTING); + } + + private NodeAwardSettingTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeAwardSettingTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("节点奖励设置")); + } + + public NodeAwardSettingTable(Table child, ForeignKey key) { + super(child, key, NODE_AWARD_SETTING); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_AWARD_SETTING_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE_AWARD_SETTING; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_AWARD_SETTING_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_AWARD_SETTING_PRIMARY); + } + + @Override + public NodeAwardSettingTable as(String alias) { + return new NodeAwardSettingTable(DSL.name(alias), this); + } + + @Override + public NodeAwardSettingTable as(Name alias) { + return new NodeAwardSettingTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeAwardSettingTable rename(String name) { + return new NodeAwardSettingTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeAwardSettingTable rename(Name name) { + return new NodeAwardSettingTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row13 type methods + // ------------------------------------------------------------------------- + + @Override + public Row13 fieldsRow() { + return (Row13) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeBuyLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeBuyLogTable.java new file mode 100644 index 0000000..7ee46b6 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeBuyLogTable.java @@ -0,0 +1,279 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeBuyLogRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 节点认购记录 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeBuyLogTable extends TableImpl { + + private static final long serialVersionUID = 1465636406; + + /** + * The reference instance of node_buy_log + */ + public static final NodeBuyLogTable NODE_BUY_LOG = new NodeBuyLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeBuyLogRecord.class; + } + + /** + * The column node_buy_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node_buy_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node_buy_log.create_by. 创建人 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "创建人"); + + /** + * The column node_buy_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node_buy_log.update_by. 更新人 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "更新人"); + + /** + * The column node_buy_log.wallet_address. 钱包地址 + */ + public final TableField WALLET_ADDRESS = createField(DSL.name("wallet_address"), org.jooq.impl.SQLDataType.VARCHAR(150).nullable(false), this, "钱包地址"); + + /** + * The column node_buy_log.recommend_id. 推荐人ID + */ + public final TableField RECOMMEND_ID = createField(DSL.name("recommend_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "推荐人ID"); + + /** + * The column node_buy_log.indirect_user_id. 间推人ID + */ + public final TableField INDIRECT_USER_ID = createField(DSL.name("indirect_user_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "间推人ID"); + + /** + * The column node_buy_log.buy_count. 认购数量 + */ + public final TableField BUY_COUNT = createField(DSL.name("buy_count"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false), this, "认购数量"); + + /** + * The column node_buy_log.pay_coin. 支付币种 + */ + public final TableField PAY_COIN = createField(DSL.name("pay_coin"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "支付币种"); + + /** + * The column node_buy_log.buy_amount. 认购金额 + */ + public final TableField BUY_AMOUNT = createField(DSL.name("buy_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "认购金额"); + + /** + * The column node_buy_log.node_setting_id. 节点配置ID + */ + public final TableField NODE_SETTING_ID = createField(DSL.name("node_setting_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "节点配置ID"); + + /** + * The column node_buy_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public final TableField STATUS = createField(DSL.name("status"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "1:订单生成 2:链上确认 3:支付成功 4:支付失败"); + + /** + * The column node_buy_log.user_id. 用户id + */ + public final TableField USER_ID = createField(DSL.name("user_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "用户id"); + + /** + * The column node_buy_log.hash. 交易hash + */ + public final TableField HASH = createField(DSL.name("hash"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "交易hash"); + + /** + * The column node_buy_log.order_number. 订单号 + */ + public final TableField ORDER_NUMBER = createField(DSL.name("order_number"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "订单号"); + + /** + * The column node_buy_log.input_address. 出账地址 + */ + public final TableField INPUT_ADDRESS = createField(DSL.name("input_address"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "出账地址"); + + /** + * The column node_buy_log.out_address. 到账地址 + */ + public final TableField OUT_ADDRESS = createField(DSL.name("out_address"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "到账地址"); + + /** + * The column node_buy_log.rebate. 推荐人返佣金额 + */ + public final TableField REBATE = createField(DSL.name("rebate"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "推荐人返佣金额"); + + /** + * The column node_buy_log.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public final TableField RBIT_AMOUNT = createField(DSL.name("rbit_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "购买盒子获取Rbit奖励数量"); + + /** + * The column node_buy_log.rbit_one. 1代Rbit奖励 + */ + public final TableField RBIT_ONE = createField(DSL.name("rbit_one"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "1代Rbit奖励"); + + /** + * The column node_buy_log.rbit_two. 2代Rbit奖励 + */ + public final TableField RBIT_TWO = createField(DSL.name("rbit_two"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "2代Rbit奖励"); + + /** + * The column node_buy_log.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public final TableField NFT_AMOUNT = createField(DSL.name("nft_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "购买盒子NFT碎片奖励数量"); + + /** + * The column node_buy_log.nft_one. 1代NFT碎片奖励 + */ + public final TableField NFT_ONE = createField(DSL.name("nft_one"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "1代NFT碎片奖励"); + + /** + * The column node_buy_log.nft_two. 2代NFT碎片奖励 + */ + public final TableField NFT_TWO = createField(DSL.name("nft_two"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "2代NFT碎片奖励"); + + /** + * The column node_buy_log.illustrate. 订单说明 + */ + public final TableField ILLUSTRATE = createField(DSL.name("illustrate"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "订单说明"); + + /** + * The column node_buy_log.top_settlement. 是否结算 1=结算 0=未结算 + */ + public final TableField TOP_SETTLEMENT = createField(DSL.name("top_settlement"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "是否结算 1=结算 0=未结算"); + + /** + * Create a node_buy_log table reference + */ + public NodeBuyLogTable() { + this(DSL.name("node_buy_log"), null); + } + + /** + * Create an aliased node_buy_log table reference + */ + public NodeBuyLogTable(String alias) { + this(DSL.name(alias), NODE_BUY_LOG); + } + + /** + * Create an aliased node_buy_log table reference + */ + public NodeBuyLogTable(Name alias) { + this(alias, NODE_BUY_LOG); + } + + private NodeBuyLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeBuyLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("节点认购记录")); + } + + public NodeBuyLogTable(Table child, ForeignKey key) { + super(child, key, NODE_BUY_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_BUY_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE_BUY_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_BUY_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_BUY_LOG_PRIMARY); + } + + @Override + public NodeBuyLogTable as(String alias) { + return new NodeBuyLogTable(DSL.name(alias), this); + } + + @Override + public NodeBuyLogTable as(Name alias) { + return new NodeBuyLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeBuyLogTable rename(String name) { + return new NodeBuyLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeBuyLogTable rename(Name name) { + return new NodeBuyLogTable(name, null); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeSettingTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeSettingTable.java new file mode 100644 index 0000000..412b75a --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeSettingTable.java @@ -0,0 +1,234 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeSettingRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row16; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 节点设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeSettingTable extends TableImpl { + + private static final long serialVersionUID = 1504056659; + + /** + * The reference instance of node_setting + */ + public static final NodeSettingTable NODE_SETTING = new NodeSettingTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeSettingRecord.class; + } + + /** + * The column node_setting.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node_setting.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node_setting.create_by. 创建人 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "创建人"); + + /** + * The column node_setting.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node_setting.update_by. 更新人 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "更新人"); + + /** + * The column node_setting.buy_coin_name. 认购币种 + */ + public final TableField BUY_COIN_NAME = createField(DSL.name("buy_coin_name"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "认购币种"); + + /** + * The column node_setting.node_total. 节点总量 + */ + public final TableField NODE_TOTAL = createField(DSL.name("node_total"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "节点总量"); + + /** + * The column node_setting.node_price. 节点价格 + */ + public final TableField NODE_PRICE = createField(DSL.name("node_price"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false), this, "节点价格"); + + /** + * The column node_setting.purchase_limit. 单地址限购数量 + */ + public final TableField PURCHASE_LIMIT = createField(DSL.name("purchase_limit"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "单地址限购数量"); + + /** + * The column node_setting.purchased_count. 已购数量 + */ + public final TableField PURCHASED_COUNT = createField(DSL.name("purchased_count"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "已购数量"); + + /** + * The column node_setting.purchased_amount. 已购金额 + */ + public final TableField PURCHASED_AMOUNT = createField(DSL.name("purchased_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "已购金额"); + + /** + * The column node_setting.status. 当前状态:1:认购中;2:已完成;3:待认购 + */ + public final TableField STATUS = createField(DSL.name("status"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.INTEGER)), this, "当前状态:1:认购中;2:已完成;3:待认购"); + + /** + * The column node_setting.node_name. 节点名称 + */ + public final TableField NODE_NAME = createField(DSL.name("node_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "节点名称"); + + /** + * The column node_setting.illustrate. 节点说明 + */ + public final TableField ILLUSTRATE = createField(DSL.name("illustrate"), org.jooq.impl.SQLDataType.CLOB, this, "节点说明"); + + /** + * The column node_setting.title. 标题 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "标题"); + + /** + * The column node_setting.node_grade. 节点等级 + */ + public final TableField NODE_GRADE = createField(DSL.name("node_grade"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "节点等级"); + + /** + * Create a node_setting table reference + */ + public NodeSettingTable() { + this(DSL.name("node_setting"), null); + } + + /** + * Create an aliased node_setting table reference + */ + public NodeSettingTable(String alias) { + this(DSL.name(alias), NODE_SETTING); + } + + /** + * Create an aliased node_setting table reference + */ + public NodeSettingTable(Name alias) { + this(alias, NODE_SETTING); + } + + private NodeSettingTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeSettingTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("节点设置")); + } + + public NodeSettingTable(Table child, ForeignKey key) { + super(child, key, NODE_SETTING); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_SETTING_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE_SETTING; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_SETTING_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_SETTING_PRIMARY); + } + + @Override + public NodeSettingTable as(String alias) { + return new NodeSettingTable(DSL.name(alias), this); + } + + @Override + public NodeSettingTable as(Name alias) { + return new NodeSettingTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeSettingTable rename(String name) { + return new NodeSettingTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeSettingTable rename(Name name) { + return new NodeSettingTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row16 type methods + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTable.java new file mode 100644 index 0000000..b68c284 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTable.java @@ -0,0 +1,219 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row13; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 用户节点表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTable extends TableImpl { + + private static final long serialVersionUID = -269629120; + + /** + * The reference instance of node + */ + public static final NodeTable NODE = new NodeTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeRecord.class; + } + + /** + * The column node.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node.create_by. 创建人 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "创建人"); + + /** + * The column node.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node.update_by. 更新人 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(20), this, "更新人"); + + /** + * The column node.buy_coin. 认购币种 + */ + public final TableField BUY_COIN = createField(DSL.name("buy_coin"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "认购币种"); + + /** + * The column node.buy_amount. 支付金额 + */ + public final TableField BUY_AMOUNT = createField(DSL.name("buy_amount"), org.jooq.impl.SQLDataType.DECIMAL(20, 8).nullable(false), this, "支付金额"); + + /** + * The column node.buy_number. 购买数量 + */ + public final TableField BUY_NUMBER = createField(DSL.name("buy_number"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "购买数量"); + + /** + * The column node.confirm_time. 确认时间 + */ + public final TableField CONFIRM_TIME = createField(DSL.name("confirm_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false), this, "确认时间"); + + /** + * The column node.user_id. 用户id + */ + public final TableField USER_ID = createField(DSL.name("user_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "用户id"); + + /** + * The column node.node_name. 节点名称 + */ + public final TableField NODE_NAME = createField(DSL.name("node_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "节点名称"); + + /** + * The column node.order_number. 订单号 + */ + public final TableField ORDER_NUMBER = createField(DSL.name("order_number"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "订单号"); + + /** + * The column node.node_setting_id. 节点配置id + */ + public final TableField NODE_SETTING_ID = createField(DSL.name("node_setting_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "节点配置id"); + + /** + * Create a node table reference + */ + public NodeTable() { + this(DSL.name("node"), null); + } + + /** + * Create an aliased node table reference + */ + public NodeTable(String alias) { + this(DSL.name(alias), NODE); + } + + /** + * Create an aliased node table reference + */ + public NodeTable(Name alias) { + this(alias, NODE); + } + + private NodeTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("用户节点表")); + } + + public NodeTable(Table child, ForeignKey key) { + super(child, key, NODE); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_PRIMARY); + } + + @Override + public NodeTable as(String alias) { + return new NodeTable(DSL.name(alias), this); + } + + @Override + public NodeTable as(Name alias) { + return new NodeTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeTable rename(String name) { + return new NodeTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeTable rename(Name name) { + return new NodeTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row13 type methods + // ------------------------------------------------------------------------- + + @Override + public Row13 fieldsRow() { + return (Row13) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskLogTable.java new file mode 100644 index 0000000..0fc3963 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskLogTable.java @@ -0,0 +1,204 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeTaskLogRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row10; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 我的任务奖励 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskLogTable extends TableImpl { + + private static final long serialVersionUID = 42400190; + + /** + * The reference instance of node_task_log + */ + public static final NodeTaskLogTable NODE_TASK_LOG = new NodeTaskLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeTaskLogRecord.class; + } + + /** + * The column node_task_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node_task_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node_task_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node_task_log.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column node_task_log.task_id. 任务id + */ + public final TableField TASK_ID = createField(DSL.name("task_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "任务id"); + + /** + * The column node_task_log.member_id. 会员id + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "会员id"); + + /** + * The column node_task_log.state. 0=待确认 1=待领取 2=已领取 + */ + public final TableField STATE = createField(DSL.name("state"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "0=待确认 1=待领取 2=已领取"); + + /** + * The column node_task_log.award_value. 奖励积分数量 + */ + public final TableField AWARD_VALUE = createField(DSL.name("award_value"), org.jooq.impl.SQLDataType.DECIMAL(20, 10).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.0000000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "奖励积分数量"); + + /** + * The column node_task_log.coin_name. 奖励币种 + */ + public final TableField COIN_NAME = createField(DSL.name("coin_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "奖励币种"); + + /** + * The column node_task_log.recommend_value. 推荐人奖励 + */ + public final TableField RECOMMEND_VALUE = createField(DSL.name("recommend_value"), org.jooq.impl.SQLDataType.DECIMAL(20, 10).nullable(false), this, "推荐人奖励"); + + /** + * Create a node_task_log table reference + */ + public NodeTaskLogTable() { + this(DSL.name("node_task_log"), null); + } + + /** + * Create an aliased node_task_log table reference + */ + public NodeTaskLogTable(String alias) { + this(DSL.name(alias), NODE_TASK_LOG); + } + + /** + * Create an aliased node_task_log table reference + */ + public NodeTaskLogTable(Name alias) { + this(alias, NODE_TASK_LOG); + } + + private NodeTaskLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeTaskLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("我的任务奖励")); + } + + public NodeTaskLogTable(Table child, ForeignKey key) { + super(child, key, NODE_TASK_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_TASK_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE_TASK_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_TASK_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_TASK_LOG_PRIMARY); + } + + @Override + public NodeTaskLogTable as(String alias) { + return new NodeTaskLogTable(DSL.name(alias), this); + } + + @Override + public NodeTaskLogTable as(Name alias) { + return new NodeTaskLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeTaskLogTable rename(String name) { + return new NodeTaskLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeTaskLogTable rename(Name name) { + return new NodeTaskLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row10 type methods + // ------------------------------------------------------------------------- + + @Override + public Row10 fieldsRow() { + return (Row10) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskTable.java new file mode 100644 index 0000000..22db131 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/NodeTaskTable.java @@ -0,0 +1,204 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.NodeTaskRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row10; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * NEER任务配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskTable extends TableImpl { + + private static final long serialVersionUID = 771159748; + + /** + * The reference instance of node_task + */ + public static final NodeTaskTable NODE_TASK = new NodeTaskTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return NodeTaskRecord.class; + } + + /** + * The column node_task.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column node_task.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column node_task.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column node_task.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column node_task.type. 类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分 + */ + public final TableField TYPE = createField(DSL.name("type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分"); + + /** + * The column node_task.title. 名称,没什么用,方便看数据库 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "名称,没什么用,方便看数据库"); + + /** + * The column node_task.award_value. 奖励数量 + */ + public final TableField AWARD_VALUE = createField(DSL.name("award_value"), org.jooq.impl.SQLDataType.DECIMAL(20, 10).nullable(false), this, "奖励数量"); + + /** + * The column node_task.recommend_value. 推荐人奖励 + */ + public final TableField RECOMMEND_VALUE = createField(DSL.name("recommend_value"), org.jooq.impl.SQLDataType.DECIMAL(20, 10).nullable(false), this, "推荐人奖励"); + + /** + * The column node_task.type2_target. 类型2的任务目标,其它类型忽略 + */ + public final TableField TYPE2_TARGET = createField(DSL.name("type2_target"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "类型2的任务目标,其它类型忽略"); + + /** + * The column node_task.coin_id. 奖励币种iD(0=战力) + */ + public final TableField COIN_ID = createField(DSL.name("coin_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "奖励币种iD(0=战力)"); + + /** + * Create a node_task table reference + */ + public NodeTaskTable() { + this(DSL.name("node_task"), null); + } + + /** + * Create an aliased node_task table reference + */ + public NodeTaskTable(String alias) { + this(DSL.name(alias), NODE_TASK); + } + + /** + * Create an aliased node_task table reference + */ + public NodeTaskTable(Name alias) { + this(alias, NODE_TASK); + } + + private NodeTaskTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private NodeTaskTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("NEER任务配置")); + } + + public NodeTaskTable(Table child, ForeignKey key) { + super(child, key, NODE_TASK); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.NODE_TASK_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_NODE_TASK; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_NODE_TASK_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_NODE_TASK_PRIMARY); + } + + @Override + public NodeTaskTable as(String alias) { + return new NodeTaskTable(DSL.name(alias), this); + } + + @Override + public NodeTaskTable as(Name alias) { + return new NodeTaskTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public NodeTaskTable rename(String name) { + return new NodeTaskTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public NodeTaskTable rename(Name name) { + return new NodeTaskTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row10 type methods + // ------------------------------------------------------------------------- + + @Override + public Row10 fieldsRow() { + return (Row10) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/PayCoinLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/PayCoinLogTable.java new file mode 100644 index 0000000..ec8c98e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/PayCoinLogTable.java @@ -0,0 +1,229 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.PayCoinLogRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row15; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 兑换币种日志表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class PayCoinLogTable extends TableImpl { + + private static final long serialVersionUID = -689816764; + + /** + * The reference instance of pay_coin_log + */ + public static final PayCoinLogTable PAY_COIN_LOG = new PayCoinLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return PayCoinLogRecord.class; + } + + /** + * The column pay_coin_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column pay_coin_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column pay_coin_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column pay_coin_log.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column pay_coin_log.member_id. 用户ID + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "用户ID"); + + /** + * The column pay_coin_log.address. 用户地址 + */ + public final TableField ADDRESS = createField(DSL.name("address"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "用户地址"); + + /** + * The column pay_coin_log.coin_id. 购买币种ID + */ + public final TableField COIN_ID = createField(DSL.name("coin_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "购买币种ID"); + + /** + * The column pay_coin_log.coin_name. 币种名称 + */ + public final TableField COIN_NAME = createField(DSL.name("coin_name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "币种名称"); + + /** + * The column pay_coin_log.pay_usdt. 支付USDT金额 + */ + public final TableField PAY_USDT = createField(DSL.name("pay_usdt"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "支付USDT金额"); + + /** + * The column pay_coin_log.amount. 到账金额 + */ + public final TableField AMOUNT = createField(DSL.name("amount"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "到账金额"); + + /** + * The column pay_coin_log.unit_price. 单价 + */ + public final TableField UNIT_PRICE = createField(DSL.name("unit_price"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "单价"); + + /** + * The column pay_coin_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public final TableField STATUS = createField(DSL.name("status"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "1:订单生成 2:链上确认 3:支付成功 4:支付失败"); + + /** + * The column pay_coin_log.hash. 交易hash + */ + public final TableField HASH = createField(DSL.name("hash"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "交易hash"); + + /** + * The column pay_coin_log.order_number. 订单号 + */ + public final TableField ORDER_NUMBER = createField(DSL.name("order_number"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "订单号"); + + /** + * The column pay_coin_log.illustrate. 订单说明 + */ + public final TableField ILLUSTRATE = createField(DSL.name("illustrate"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "订单说明"); + + /** + * Create a pay_coin_log table reference + */ + public PayCoinLogTable() { + this(DSL.name("pay_coin_log"), null); + } + + /** + * Create an aliased pay_coin_log table reference + */ + public PayCoinLogTable(String alias) { + this(DSL.name(alias), PAY_COIN_LOG); + } + + /** + * Create an aliased pay_coin_log table reference + */ + public PayCoinLogTable(Name alias) { + this(alias, PAY_COIN_LOG); + } + + private PayCoinLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private PayCoinLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("兑换币种日志表")); + } + + public PayCoinLogTable(Table child, ForeignKey key) { + super(child, key, PAY_COIN_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.PAY_COIN_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_PAY_COIN_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_PAY_COIN_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_PAY_COIN_LOG_PRIMARY); + } + + @Override + public PayCoinLogTable as(String alias) { + return new PayCoinLogTable(DSL.name(alias), this); + } + + @Override + public PayCoinLogTable as(Name alias) { + return new PayCoinLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public PayCoinLogTable rename(String name) { + return new PayCoinLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public PayCoinLogTable rename(Name name) { + return new PayCoinLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row15 type methods + // ------------------------------------------------------------------------- + + @Override + public Row15 fieldsRow() { + return (Row15) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/SysAccountTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/SysAccountTable.java new file mode 100644 index 0000000..a7eb7a1 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/SysAccountTable.java @@ -0,0 +1,208 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.SysAccountRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row11; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 系统账户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysAccountTable extends TableImpl { + + private static final long serialVersionUID = 1002967071; + + /** + * The reference instance of sys_account + */ + public static final SysAccountTable SYS_ACCOUNT = new SysAccountTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return SysAccountRecord.class; + } + + /** + * The column sys_account.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column sys_account.create_time. + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_account.update_time. + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_account.flag. 1正常,0删除 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "1正常,0删除"); + + /** + * The column sys_account.account. 账户 + */ + public final TableField ACCOUNT = createField(DSL.name("account"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "账户"); + + /** + * The column sys_account.name. 名字 + */ + public final TableField NAME = createField(DSL.name("name"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "名字"); + + /** + * The column sys_account.password. 密码 + */ + public final TableField PASSWORD = createField(DSL.name("password"), org.jooq.impl.SQLDataType.VARCHAR(2048).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "密码"); + + /** + * The column sys_account.status. 状态,0冻结 + */ + public final TableField STATUS = createField(DSL.name("status"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.TINYINT)), this, "状态,0冻结"); + + /** + * The column sys_account.email. 邮箱 + */ + public final TableField EMAIL = createField(DSL.name("email"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "邮箱"); + + /** + * The column sys_account.role_id. + */ + public final TableField ROLE_ID = createField(DSL.name("role_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, ""); + + /** + * The column sys_account.address. 地址 + */ + public final TableField ADDRESS = createField(DSL.name("address"), org.jooq.impl.SQLDataType.VARCHAR(66), this, "地址"); + + /** + * Create a sys_account table reference + */ + public SysAccountTable() { + this(DSL.name("sys_account"), null); + } + + /** + * Create an aliased sys_account table reference + */ + public SysAccountTable(String alias) { + this(DSL.name(alias), SYS_ACCOUNT); + } + + /** + * Create an aliased sys_account table reference + */ + public SysAccountTable(Name alias) { + this(alias, SYS_ACCOUNT); + } + + private SysAccountTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private SysAccountTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("系统账户")); + } + + public SysAccountTable(Table child, ForeignKey key) { + super(child, key, SYS_ACCOUNT); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.SYS_ACCOUNT_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_SYS_ACCOUNT; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_SYS_ACCOUNT_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_SYS_ACCOUNT_PRIMARY); + } + + @Override + public SysAccountTable as(String alias) { + return new SysAccountTable(DSL.name(alias), this); + } + + @Override + public SysAccountTable as(Name alias) { + return new SysAccountTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public SysAccountTable rename(String name) { + return new SysAccountTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public SysAccountTable rename(Name name) { + return new SysAccountTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row11 type methods + // ------------------------------------------------------------------------- + + @Override + public Row11 fieldsRow() { + return (Row11) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/SysActionLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/SysActionLogTable.java new file mode 100644 index 0000000..d82759e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/SysActionLogTable.java @@ -0,0 +1,213 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.SysActionLogRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row12; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 系统操作日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysActionLogTable extends TableImpl { + + private static final long serialVersionUID = 1067903224; + + /** + * The reference instance of sys_action_log + */ + public static final SysActionLogTable SYS_ACTION_LOG = new SysActionLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return SysActionLogRecord.class; + } + + /** + * The column sys_action_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column sys_action_log.create_time. + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_action_log.update_time. + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_action_log.create_by. + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, ""); + + /** + * The column sys_action_log.flag. 1正常,0删除 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "1正常,0删除"); + + /** + * The column sys_action_log.account_id. 用户 + */ + public final TableField ACCOUNT_ID = createField(DSL.name("account_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "用户"); + + /** + * The column sys_action_log.action. 操作名 + */ + public final TableField ACTION = createField(DSL.name("action"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "操作名"); + + /** + * The column sys_action_log.action_uri. + */ + public final TableField ACTION_URI = createField(DSL.name("action_uri"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, ""); + + /** + * The column sys_action_log.action_params. 参数 + */ + public final TableField ACTION_PARAMS = createField(DSL.name("action_params"), org.jooq.impl.SQLDataType.CLOB.nullable(false), this, "参数"); + + /** + * The column sys_action_log.action_time. + */ + public final TableField ACTION_TIME = createField(DSL.name("action_time"), org.jooq.impl.SQLDataType.TIMESTAMP, this, ""); + + /** + * The column sys_action_log.user_agent. + */ + public final TableField USER_AGENT = createField(DSL.name("user_agent"), org.jooq.impl.SQLDataType.VARCHAR(255), this, ""); + + /** + * The column sys_action_log.ip. + */ + public final TableField IP = createField(DSL.name("ip"), org.jooq.impl.SQLDataType.VARCHAR(255), this, ""); + + /** + * Create a sys_action_log table reference + */ + public SysActionLogTable() { + this(DSL.name("sys_action_log"), null); + } + + /** + * Create an aliased sys_action_log table reference + */ + public SysActionLogTable(String alias) { + this(DSL.name(alias), SYS_ACTION_LOG); + } + + /** + * Create an aliased sys_action_log table reference + */ + public SysActionLogTable(Name alias) { + this(alias, SYS_ACTION_LOG); + } + + private SysActionLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private SysActionLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("系统操作日志")); + } + + public SysActionLogTable(Table child, ForeignKey key) { + super(child, key, SYS_ACTION_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.SYS_ACTION_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_SYS_ACTION_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_SYS_ACTION_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_SYS_ACTION_LOG_PRIMARY); + } + + @Override + public SysActionLogTable as(String alias) { + return new SysActionLogTable(DSL.name(alias), this); + } + + @Override + public SysActionLogTable as(Name alias) { + return new SysActionLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public SysActionLogTable rename(String name) { + return new SysActionLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public SysActionLogTable rename(Name name) { + return new SysActionLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row12 type methods + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/SysConfigTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/SysConfigTable.java new file mode 100644 index 0000000..c3e934b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/SysConfigTable.java @@ -0,0 +1,208 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.SysConfigRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row11; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 一些配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysConfigTable extends TableImpl { + + private static final long serialVersionUID = -1679223067; + + /** + * The reference instance of sys_config + */ + public static final SysConfigTable SYS_CONFIG = new SysConfigTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return SysConfigRecord.class; + } + + /** + * The column sys_config.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column sys_config.create_time. + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_config.update_time. + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column sys_config.flag. 1正常,0删除 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "1正常,0删除"); + + /** + * The column sys_config.type. 分类,根据业务分组 + */ + public final TableField TYPE = createField(DSL.name("type"), org.jooq.impl.SQLDataType.TINYINT.nullable(false), this, "分类,根据业务分组"); + + /** + * The column sys_config.config_key. key + */ + public final TableField CONFIG_KEY = createField(DSL.name("config_key"), org.jooq.impl.SQLDataType.VARCHAR(63).nullable(false), this, "key"); + + /** + * The column sys_config.value_type. 1小数,2百分数,3字符串,4json,5整数 + */ + public final TableField VALUE_TYPE = createField(DSL.name("value_type"), org.jooq.impl.SQLDataType.TINYINT.nullable(false), this, "1小数,2百分数,3字符串,4json,5整数"); + + /** + * The column sys_config.value. + */ + public final TableField VALUE = createField(DSL.name("value"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, ""); + + /** + * The column sys_config.default_value. + */ + public final TableField DEFAULT_VALUE = createField(DSL.name("default_value"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, ""); + + /** + * The column sys_config.description. + */ + public final TableField DESCRIPTION = createField(DSL.name("description"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, ""); + + /** + * The column sys_config.default_description. + */ + public final TableField DEFAULT_DESCRIPTION = createField(DSL.name("default_description"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, ""); + + /** + * Create a sys_config table reference + */ + public SysConfigTable() { + this(DSL.name("sys_config"), null); + } + + /** + * Create an aliased sys_config table reference + */ + public SysConfigTable(String alias) { + this(DSL.name(alias), SYS_CONFIG); + } + + /** + * Create an aliased sys_config table reference + */ + public SysConfigTable(Name alias) { + this(alias, SYS_CONFIG); + } + + private SysConfigTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private SysConfigTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("一些配置")); + } + + public SysConfigTable(Table child, ForeignKey key) { + super(child, key, SYS_CONFIG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.SYS_CONFIG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_SYS_CONFIG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_SYS_CONFIG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_SYS_CONFIG_PRIMARY); + } + + @Override + public SysConfigTable as(String alias) { + return new SysConfigTable(DSL.name(alias), this); + } + + @Override + public SysConfigTable as(Name alias) { + return new SysConfigTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public SysConfigTable rename(String name) { + return new SysConfigTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public SysConfigTable rename(Name name) { + return new SysConfigTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row11 type methods + // ------------------------------------------------------------------------- + + @Override + public Row11 fieldsRow() { + return (Row11) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/SysMenuTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/SysMenuTable.java new file mode 100644 index 0000000..5fb7812 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/SysMenuTable.java @@ -0,0 +1,233 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.SysMenuRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row16; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 菜单权限表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysMenuTable extends TableImpl { + + private static final long serialVersionUID = -958729292; + + /** + * The reference instance of sys_menu + */ + public static final SysMenuTable SYS_MENU = new SysMenuTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return SysMenuRecord.class; + } + + /** + * The column sys_menu.menu_id. 菜单ID + */ + public final TableField MENU_ID = createField(DSL.name("menu_id"), org.jooq.impl.SQLDataType.BIGINT.nullable(false).identity(true), this, "菜单ID"); + + /** + * The column sys_menu.menu_name. 菜单名称 + */ + public final TableField MENU_NAME = createField(DSL.name("menu_name"), org.jooq.impl.SQLDataType.VARCHAR(50).nullable(false), this, "菜单名称"); + + /** + * The column sys_menu.parent_id. 父菜单ID + */ + public final TableField PARENT_ID = createField(DSL.name("parent_id"), org.jooq.impl.SQLDataType.BIGINT.defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.BIGINT)), this, "父菜单ID"); + + /** + * The column sys_menu.order_num. 显示顺序 + */ + public final TableField ORDER_NUM = createField(DSL.name("order_num"), org.jooq.impl.SQLDataType.INTEGER.defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "显示顺序"); + + /** + * The column sys_menu.url. 请求地址 + */ + public final TableField URL = createField(DSL.name("url"), org.jooq.impl.SQLDataType.VARCHAR(200).defaultValue(org.jooq.impl.DSL.inline("#", org.jooq.impl.SQLDataType.VARCHAR)), this, "请求地址"); + + /** + * The column sys_menu.target. 打开方式(menuItem页签 menuBlank新窗口) + */ + public final TableField TARGET = createField(DSL.name("target"), org.jooq.impl.SQLDataType.VARCHAR(20).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "打开方式(menuItem页签 menuBlank新窗口)"); + + /** + * The column sys_menu.menu_type. 菜单类型(M目录 C菜单 F按钮) + */ + public final TableField MENU_TYPE = createField(DSL.name("menu_type"), org.jooq.impl.SQLDataType.CHAR(1).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.CHAR)), this, "菜单类型(M目录 C菜单 F按钮)"); + + /** + * The column sys_menu.visible. 菜单状态(0显示 1隐藏) + */ + public final TableField VISIBLE = createField(DSL.name("visible"), org.jooq.impl.SQLDataType.CHAR(1).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.CHAR)), this, "菜单状态(0显示 1隐藏)"); + + /** + * The column sys_menu.is_refresh. 是否刷新(0刷新 1不刷新) + */ + public final TableField IS_REFRESH = createField(DSL.name("is_refresh"), org.jooq.impl.SQLDataType.CHAR(1).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.CHAR)), this, "是否刷新(0刷新 1不刷新)"); + + /** + * The column sys_menu.perms. 权限标识 + */ + public final TableField PERMS = createField(DSL.name("perms"), org.jooq.impl.SQLDataType.VARCHAR(100), this, "权限标识"); + + /** + * The column sys_menu.icon. 菜单图标 + */ + public final TableField ICON = createField(DSL.name("icon"), org.jooq.impl.SQLDataType.VARCHAR(100).defaultValue(org.jooq.impl.DSL.inline("#", org.jooq.impl.SQLDataType.VARCHAR)), this, "菜单图标"); + + /** + * The column sys_menu.create_by. 创建者 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(64).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "创建者"); + + /** + * The column sys_menu.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP, this, "创建时间"); + + /** + * The column sys_menu.update_by. 更新者 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(64).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "更新者"); + + /** + * The column sys_menu.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP, this, "更新时间"); + + /** + * The column sys_menu.remark. 备注 + */ + public final TableField REMARK = createField(DSL.name("remark"), org.jooq.impl.SQLDataType.VARCHAR(500).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "备注"); + + /** + * Create a sys_menu table reference + */ + public SysMenuTable() { + this(DSL.name("sys_menu"), null); + } + + /** + * Create an aliased sys_menu table reference + */ + public SysMenuTable(String alias) { + this(DSL.name(alias), SYS_MENU); + } + + /** + * Create an aliased sys_menu table reference + */ + public SysMenuTable(Name alias) { + this(alias, SYS_MENU); + } + + private SysMenuTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private SysMenuTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("菜单权限表")); + } + + public SysMenuTable(Table child, ForeignKey key) { + super(child, key, SYS_MENU); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.SYS_MENU_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_SYS_MENU; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_SYS_MENU_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_SYS_MENU_PRIMARY); + } + + @Override + public SysMenuTable as(String alias) { + return new SysMenuTable(DSL.name(alias), this); + } + + @Override + public SysMenuTable as(Name alias) { + return new SysMenuTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public SysMenuTable rename(String name) { + return new SysMenuTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public SysMenuTable rename(Name name) { + return new SysMenuTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row16 type methods + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/SysRoleTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/SysRoleTable.java new file mode 100644 index 0000000..1bdb794 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/SysRoleTable.java @@ -0,0 +1,213 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.SysRoleRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row12; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 角色信息表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysRoleTable extends TableImpl { + + private static final long serialVersionUID = 1033846564; + + /** + * The reference instance of sys_role + */ + public static final SysRoleTable SYS_ROLE = new SysRoleTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return SysRoleRecord.class; + } + + /** + * The column sys_role.role_id. 角色ID + */ + public final TableField ROLE_ID = createField(DSL.name("role_id"), org.jooq.impl.SQLDataType.BIGINT.nullable(false).identity(true), this, "角色ID"); + + /** + * The column sys_role.role_name. 角色名称 + */ + public final TableField ROLE_NAME = createField(DSL.name("role_name"), org.jooq.impl.SQLDataType.VARCHAR(30).nullable(false), this, "角色名称"); + + /** + * The column sys_role.role_key. 角色权限字符串 + */ + public final TableField ROLE_KEY = createField(DSL.name("role_key"), org.jooq.impl.SQLDataType.VARCHAR(100).nullable(false), this, "角色权限字符串"); + + /** + * The column sys_role.role_sort. 显示顺序 + */ + public final TableField ROLE_SORT = createField(DSL.name("role_sort"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "显示顺序"); + + /** + * The column sys_role.data_scope. 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) + */ + public final TableField DATA_SCOPE = createField(DSL.name("data_scope"), org.jooq.impl.SQLDataType.CHAR(1).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.CHAR)), this, "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)"); + + /** + * The column sys_role.status. 角色状态(0正常 1停用) + */ + public final TableField STATUS = createField(DSL.name("status"), org.jooq.impl.SQLDataType.CHAR(1).nullable(false), this, "角色状态(0正常 1停用)"); + + /** + * The column sys_role.del_flag. 删除标志(0代表存在 2代表删除) + */ + public final TableField DEL_FLAG = createField(DSL.name("del_flag"), org.jooq.impl.SQLDataType.CHAR(1).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.CHAR)), this, "删除标志(0代表存在 2代表删除)"); + + /** + * The column sys_role.create_by. 创建者 + */ + public final TableField CREATE_BY = createField(DSL.name("create_by"), org.jooq.impl.SQLDataType.VARCHAR(64).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "创建者"); + + /** + * The column sys_role.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP, this, "创建时间"); + + /** + * The column sys_role.update_by. 更新者 + */ + public final TableField UPDATE_BY = createField(DSL.name("update_by"), org.jooq.impl.SQLDataType.VARCHAR(64).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "更新者"); + + /** + * The column sys_role.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP, this, "更新时间"); + + /** + * The column sys_role.remark. 备注 + */ + public final TableField REMARK = createField(DSL.name("remark"), org.jooq.impl.SQLDataType.VARCHAR(500), this, "备注"); + + /** + * Create a sys_role table reference + */ + public SysRoleTable() { + this(DSL.name("sys_role"), null); + } + + /** + * Create an aliased sys_role table reference + */ + public SysRoleTable(String alias) { + this(DSL.name(alias), SYS_ROLE); + } + + /** + * Create an aliased sys_role table reference + */ + public SysRoleTable(Name alias) { + this(alias, SYS_ROLE); + } + + private SysRoleTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private SysRoleTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("角色信息表")); + } + + public SysRoleTable(Table child, ForeignKey key) { + super(child, key, SYS_ROLE); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.SYS_ROLE_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_SYS_ROLE; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_SYS_ROLE_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_SYS_ROLE_PRIMARY); + } + + @Override + public SysRoleTable as(String alias) { + return new SysRoleTable(DSL.name(alias), this); + } + + @Override + public SysRoleTable as(Name alias) { + return new SysRoleTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public SysRoleTable rename(String name) { + return new SysRoleTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public SysRoleTable rename(Name name) { + return new SysRoleTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row12 type methods + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberSignTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberSignTable.java new file mode 100644 index 0000000..55e3006 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberSignTable.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TMemberSignRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row7; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 用户签名交易对 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberSignTable extends TableImpl { + + private static final long serialVersionUID = 315458611; + + /** + * The reference instance of t_member_sign + */ + public static final TMemberSignTable T_MEMBER_SIGN = new TMemberSignTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TMemberSignRecord.class; + } + + /** + * The column t_member_sign.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_member_sign.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_member_sign.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_member_sign.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_member_sign.address. 账号 + */ + public final TableField ADDRESS = createField(DSL.name("address"), org.jooq.impl.SQLDataType.VARCHAR(80).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "账号"); + + /** + * The column t_member_sign.public_key. 公钥 + */ + public final TableField PUBLIC_KEY = createField(DSL.name("public_key"), org.jooq.impl.SQLDataType.VARCHAR(80).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "公钥"); + + /** + * The column t_member_sign.private_key. 私钥 + */ + public final TableField PRIVATE_KEY = createField(DSL.name("private_key"), org.jooq.impl.SQLDataType.VARCHAR(80).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "私钥"); + + /** + * Create a t_member_sign table reference + */ + public TMemberSignTable() { + this(DSL.name("t_member_sign"), null); + } + + /** + * Create an aliased t_member_sign table reference + */ + public TMemberSignTable(String alias) { + this(DSL.name(alias), T_MEMBER_SIGN); + } + + /** + * Create an aliased t_member_sign table reference + */ + public TMemberSignTable(Name alias) { + this(alias, T_MEMBER_SIGN); + } + + private TMemberSignTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TMemberSignTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("用户签名交易对")); + } + + public TMemberSignTable(Table child, ForeignKey key) { + super(child, key, T_MEMBER_SIGN); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_MEMBER_SIGN_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_MEMBER_SIGN; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_MEMBER_SIGN_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_MEMBER_SIGN_PRIMARY); + } + + @Override + public TMemberSignTable as(String alias) { + return new TMemberSignTable(DSL.name(alias), this); + } + + @Override + public TMemberSignTable as(Name alias) { + return new TMemberSignTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TMemberSignTable rename(String name) { + return new TMemberSignTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TMemberSignTable rename(Name name) { + return new TMemberSignTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row7 type methods + // ------------------------------------------------------------------------- + + @Override + public Row7 fieldsRow() { + return (Row7) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberTable.java new file mode 100644 index 0000000..1e422f4 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberTable.java @@ -0,0 +1,276 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TMemberRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 用户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberTable extends TableImpl { + + private static final long serialVersionUID = -1128604078; + + /** + * The reference instance of t_member + */ + public static final TMemberTable T_MEMBER = new TMemberTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TMemberRecord.class; + } + + /** + * The column t_member.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_member.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_member.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_member.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_member.account. 账号 + */ + public final TableField ACCOUNT = createField(DSL.name("account"), org.jooq.impl.SQLDataType.VARCHAR(80).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "账号"); + + /** + * The column t_member.account_type. 账号类型,1地址,2邮箱 + */ + public final TableField ACCOUNT_TYPE = createField(DSL.name("account_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "账号类型,1地址,2邮箱"); + + /** + * The column t_member.refer_id. 推荐人ID + */ + public final TableField REFER_ID = createField(DSL.name("refer_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "推荐人ID"); + + /** + * The column t_member.all_pid. 上面的人 + */ + public final TableField ALL_PID = createField(DSL.name("all_pid"), org.jooq.impl.SQLDataType.VARCHAR(500).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "上面的人"); + + /** + * The column t_member.password_login. 登录密码 + */ + public final TableField PASSWORD_LOGIN = createField(DSL.name("password_login"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "登录密码"); + + /** + * The column t_member.password_pay. 支付密码 + */ + public final TableField PASSWORD_PAY = createField(DSL.name("password_pay"), org.jooq.impl.SQLDataType.VARCHAR(40).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "支付密码"); + + /** + * The column t_member.share_code. 邀请码 + */ + public final TableField SHARE_CODE = createField(DSL.name("share_code"), org.jooq.impl.SQLDataType.VARCHAR(10).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "邀请码"); + + /** + * The column t_member.uid. 8位UID + */ + public final TableField UID = createField(DSL.name("uid"), org.jooq.impl.SQLDataType.VARCHAR(10).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "8位UID"); + + /** + * The column t_member.level. 等级,看代码 + */ + public final TableField LEVEL = createField(DSL.name("level"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "等级,看代码"); + + /** + * The column t_member.min_level. 后台设置的等级 + */ + public final TableField MIN_LEVEL = createField(DSL.name("min_level"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "后台设置的等级"); + + /** + * The column t_member.share_num. 直推人数 + */ + public final TableField SHARE_NUM = createField(DSL.name("share_num"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "直推人数"); + + /** + * The column t_member.team_num. 团队人数,含自己 + */ + public final TableField TEAM_NUM = createField(DSL.name("team_num"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "团队人数,含自己"); + + /** + * The column t_member.chain_type. 链类型:1=Bitcoin2= +Ethereum3= +Polygon4= +BNB Chain 5=Arbitrum One + */ + public final TableField CHAIN_TYPE = createField(DSL.name("chain_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.INTEGER)), this, "链类型:1=Bitcoin2=\nEthereum3=\nPolygon4=\nBNB Chain 5=Arbitrum One"); + + /** + * The column t_member.code_prompt. 是否提示绑定邀请码 0=未提示 1=已提示 + */ + public final TableField CODE_PROMPT = createField(DSL.name("code_prompt"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "是否提示绑定邀请码 0=未提示 1=已提示"); + + /** + * The column t_member.twitter_type. 是否更新推特 0=未更新 1=已更新 + */ + public final TableField TWITTER_TYPE = createField(DSL.name("twitter_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "是否更新推特 0=未更新 1=已更新"); + + /** + * The column t_member.twitter_id. 推特id + */ + public final TableField TWITTER_ID = createField(DSL.name("twitter_id"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "推特id"); + + /** + * The column t_member.twitter_name. 推特账号 + */ + public final TableField TWITTER_NAME = createField(DSL.name("twitter_name"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "推特账号"); + + /** + * The column t_member.twitter_img. 用户头像 + */ + public final TableField TWITTER_IMG = createField(DSL.name("twitter_img"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "用户头像"); + + /** + * The column t_member.twitter_user_name. 用户名称 + */ + public final TableField TWITTER_USER_NAME = createField(DSL.name("twitter_user_name"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "用户名称"); + + /** + * The column t_member.discord_id. 用户DiscordID + */ + public final TableField DISCORD_ID = createField(DSL.name("discord_id"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "用户DiscordID"); + + /** + * The column t_member.tg_id. 用户TG ID + */ + public final TableField TG_ID = createField(DSL.name("tg_id"), org.jooq.impl.SQLDataType.VARCHAR(255), this, "用户TG ID"); + + /** + * The column t_member.top_user. 特定顶级用户 1=是 0=普通用户 + */ + public final TableField TOP_USER = createField(DSL.name("top_user"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "特定顶级用户 1=是 0=普通用户"); + + /** + * Create a t_member table reference + */ + public TMemberTable() { + this(DSL.name("t_member"), null); + } + + /** + * Create an aliased t_member table reference + */ + public TMemberTable(String alias) { + this(DSL.name(alias), T_MEMBER); + } + + /** + * Create an aliased t_member table reference + */ + public TMemberTable(Name alias) { + this(alias, T_MEMBER); + } + + private TMemberTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TMemberTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("用户")); + } + + public TMemberTable(Table child, ForeignKey key) { + super(child, key, T_MEMBER); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_MEMBER_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_MEMBER; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_MEMBER_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_MEMBER_PRIMARY); + } + + @Override + public TMemberTable as(String alias) { + return new TMemberTable(DSL.name(alias), this); + } + + @Override + public TMemberTable as(Name alias) { + return new TMemberTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TMemberTable rename(String name) { + return new TMemberTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TMemberTable rename(Name name) { + return new TMemberTable(name, null); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletLogTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletLogTable.java new file mode 100644 index 0000000..d62c266 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletLogTable.java @@ -0,0 +1,224 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TMemberWalletLogRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row14; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 资产流水 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletLogTable extends TableImpl { + + private static final long serialVersionUID = -771081882; + + /** + * The reference instance of t_member_wallet_log + */ + public static final TMemberWalletLogTable T_MEMBER_WALLET_LOG = new TMemberWalletLogTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TMemberWalletLogRecord.class; + } + + /** + * The column t_member_wallet_log.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_member_wallet_log.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_member_wallet_log.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_member_wallet_log.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_member_wallet_log.member_id. + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, ""); + + /** + * The column t_member_wallet_log.wallet_id. + */ + public final TableField WALLET_ID = createField(DSL.name("wallet_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, ""); + + /** + * The column t_member_wallet_log.type. 1余额,2冻结 + */ + public final TableField TYPE = createField(DSL.name("type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "1余额,2冻结"); + + /** + * The column t_member_wallet_log.coin_id. 币种id + */ + public final TableField COIN_ID = createField(DSL.name("coin_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "币种id"); + + /** + * The column t_member_wallet_log.op_type. + */ + public final TableField OP_TYPE = createField(DSL.name("op_type"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, ""); + + /** + * The column t_member_wallet_log.op_remark. 流水类型 + */ + public final TableField OP_REMARK = createField(DSL.name("op_remark"), org.jooq.impl.SQLDataType.VARCHAR(20).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "流水类型"); + + /** + * The column t_member_wallet_log.op_value. + */ + public final TableField OP_VALUE = createField(DSL.name("op_value"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, ""); + + /** + * The column t_member_wallet_log.op_before. + */ + public final TableField OP_BEFORE = createField(DSL.name("op_before"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, ""); + + /** + * The column t_member_wallet_log.op_after. + */ + public final TableField OP_AFTER = createField(DSL.name("op_after"), org.jooq.impl.SQLDataType.DECIMAL(16, 6).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.000000", org.jooq.impl.SQLDataType.DECIMAL)), this, ""); + + /** + * The column t_member_wallet_log.ext_remark. 额外的备注 + */ + public final TableField EXT_REMARK = createField(DSL.name("ext_remark"), org.jooq.impl.SQLDataType.VARCHAR(30).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "额外的备注"); + + /** + * Create a t_member_wallet_log table reference + */ + public TMemberWalletLogTable() { + this(DSL.name("t_member_wallet_log"), null); + } + + /** + * Create an aliased t_member_wallet_log table reference + */ + public TMemberWalletLogTable(String alias) { + this(DSL.name(alias), T_MEMBER_WALLET_LOG); + } + + /** + * Create an aliased t_member_wallet_log table reference + */ + public TMemberWalletLogTable(Name alias) { + this(alias, T_MEMBER_WALLET_LOG); + } + + private TMemberWalletLogTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TMemberWalletLogTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("资产流水")); + } + + public TMemberWalletLogTable(Table child, ForeignKey key) { + super(child, key, T_MEMBER_WALLET_LOG); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_MEMBER_WALLET_LOG_IDX_MID, Indexes.T_MEMBER_WALLET_LOG_IDX_WALLET_TYPE, Indexes.T_MEMBER_WALLET_LOG_IDX_WID, Indexes.T_MEMBER_WALLET_LOG_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_MEMBER_WALLET_LOG; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_MEMBER_WALLET_LOG_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_MEMBER_WALLET_LOG_PRIMARY); + } + + @Override + public TMemberWalletLogTable as(String alias) { + return new TMemberWalletLogTable(DSL.name(alias), this); + } + + @Override + public TMemberWalletLogTable as(Name alias) { + return new TMemberWalletLogTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TMemberWalletLogTable rename(String name) { + return new TMemberWalletLogTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TMemberWalletLogTable rename(Name name) { + return new TMemberWalletLogTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row14 type methods + // ------------------------------------------------------------------------- + + @Override + public Row14 fieldsRow() { + return (Row14) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletTable.java new file mode 100644 index 0000000..3e71a1e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TMemberWalletTable.java @@ -0,0 +1,194 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TMemberWalletRecord; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row8; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 资产 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletTable extends TableImpl { + + private static final long serialVersionUID = -853836990; + + /** + * The reference instance of t_member_wallet + */ + public static final TMemberWalletTable T_MEMBER_WALLET = new TMemberWalletTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TMemberWalletRecord.class; + } + + /** + * The column t_member_wallet.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_member_wallet.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_member_wallet.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_member_wallet.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_member_wallet.member_id. + */ + public final TableField MEMBER_ID = createField(DSL.name("member_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, ""); + + /** + * The column t_member_wallet.coin_id. 币种id + */ + public final TableField COIN_ID = createField(DSL.name("coin_id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "币种id"); + + /** + * The column t_member_wallet.balance. 余额 + */ + public final TableField BALANCE = createField(DSL.name("balance"), org.jooq.impl.SQLDataType.DECIMAL(16, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "余额"); + + /** + * The column t_member_wallet.frozen. 冻结,余额的一部分 + */ + public final TableField FROZEN = createField(DSL.name("frozen"), org.jooq.impl.SQLDataType.DECIMAL(16, 8).nullable(false).defaultValue(org.jooq.impl.DSL.inline("0.00000000", org.jooq.impl.SQLDataType.DECIMAL)), this, "冻结,余额的一部分"); + + /** + * Create a t_member_wallet table reference + */ + public TMemberWalletTable() { + this(DSL.name("t_member_wallet"), null); + } + + /** + * Create an aliased t_member_wallet table reference + */ + public TMemberWalletTable(String alias) { + this(DSL.name(alias), T_MEMBER_WALLET); + } + + /** + * Create an aliased t_member_wallet table reference + */ + public TMemberWalletTable(Name alias) { + this(alias, T_MEMBER_WALLET); + } + + private TMemberWalletTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TMemberWalletTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("资产")); + } + + public TMemberWalletTable(Table child, ForeignKey key) { + super(child, key, T_MEMBER_WALLET); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_MEMBER_WALLET_IDX_MID, Indexes.T_MEMBER_WALLET_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_MEMBER_WALLET; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_MEMBER_WALLET_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_MEMBER_WALLET_PRIMARY); + } + + @Override + public TMemberWalletTable as(String alias) { + return new TMemberWalletTable(DSL.name(alias), this); + } + + @Override + public TMemberWalletTable as(Name alias) { + return new TMemberWalletTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TMemberWalletTable rename(String name) { + return new TMemberWalletTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TMemberWalletTable rename(Name name) { + return new TMemberWalletTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row8 type methods + // ------------------------------------------------------------------------- + + @Override + public Row8 fieldsRow() { + return (Row8) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TUniBannerTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TUniBannerTable.java new file mode 100644 index 0000000..edec526 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TUniBannerTable.java @@ -0,0 +1,198 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TUniBannerRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row9; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * Banner + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniBannerTable extends TableImpl { + + private static final long serialVersionUID = -1920796824; + + /** + * The reference instance of t_uni_banner + */ + public static final TUniBannerTable T_UNI_BANNER = new TUniBannerTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TUniBannerRecord.class; + } + + /** + * The column t_uni_banner.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_uni_banner.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_uni_banner.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_uni_banner.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_uni_banner.lang. 语言 + */ + public final TableField LANG = createField(DSL.name("lang"), org.jooq.impl.SQLDataType.VARCHAR(10).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "语言"); + + /** + * The column t_uni_banner.title. 标题 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(127).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "标题"); + + /** + * The column t_uni_banner.image_url. 图片链接 + */ + public final TableField IMAGE_URL = createField(DSL.name("image_url"), org.jooq.impl.SQLDataType.VARCHAR(1024).nullable(false), this, "图片链接"); + + /** + * The column t_uni_banner.state. 0隐藏,1显示 + */ + public final TableField STATE = createField(DSL.name("state"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "0隐藏,1显示"); + + /** + * The column t_uni_banner.target_url. 跳转链接 + */ + public final TableField TARGET_URL = createField(DSL.name("target_url"), org.jooq.impl.SQLDataType.VARCHAR(1024).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "跳转链接"); + + /** + * Create a t_uni_banner table reference + */ + public TUniBannerTable() { + this(DSL.name("t_uni_banner"), null); + } + + /** + * Create an aliased t_uni_banner table reference + */ + public TUniBannerTable(String alias) { + this(DSL.name(alias), T_UNI_BANNER); + } + + /** + * Create an aliased t_uni_banner table reference + */ + public TUniBannerTable(Name alias) { + this(alias, T_UNI_BANNER); + } + + private TUniBannerTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TUniBannerTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("Banner")); + } + + public TUniBannerTable(Table child, ForeignKey key) { + super(child, key, T_UNI_BANNER); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_UNI_BANNER_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_UNI_BANNER; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_UNI_BANNER_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_UNI_BANNER_PRIMARY); + } + + @Override + public TUniBannerTable as(String alias) { + return new TUniBannerTable(DSL.name(alias), this); + } + + @Override + public TUniBannerTable as(Name alias) { + return new TUniBannerTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TUniBannerTable rename(String name) { + return new TUniBannerTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TUniBannerTable rename(Name name) { + return new TUniBannerTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row9 type methods + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/TUniNoticeTable.java b/alive-db/src/main/java/com/alive/db/jooq/tables/TUniNoticeTable.java new file mode 100644 index 0000000..67c34dd --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/TUniNoticeTable.java @@ -0,0 +1,198 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables; + + +import com.alive.db.jooq.DefaultSchema; +import com.alive.db.jooq.Indexes; +import com.alive.db.jooq.Keys; +import com.alive.db.jooq.tables.records.TUniNoticeRecord; + +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row9; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + + +/** + * 公告 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniNoticeTable extends TableImpl { + + private static final long serialVersionUID = -1897248547; + + /** + * The reference instance of t_uni_notice + */ + public static final TUniNoticeTable T_UNI_NOTICE = new TUniNoticeTable(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TUniNoticeRecord.class; + } + + /** + * The column t_uni_notice.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column t_uni_notice.create_time. 创建时间 + */ + public final TableField CREATE_TIME = createField(DSL.name("create_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "创建时间"); + + /** + * The column t_uni_notice.update_time. 更新时间 + */ + public final TableField UPDATE_TIME = createField(DSL.name("update_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "更新时间"); + + /** + * The column t_uni_notice.flag. 标记删除,0 / 1 + */ + public final TableField FLAG = createField(DSL.name("flag"), org.jooq.impl.SQLDataType.TINYINT.nullable(false).defaultValue(org.jooq.impl.DSL.inline("1", org.jooq.impl.SQLDataType.TINYINT)), this, "标记删除,0 / 1"); + + /** + * The column t_uni_notice.title. 标题 + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(127).nullable(false), this, "标题"); + + /** + * The column t_uni_notice.content. 内容 + */ + public final TableField CONTENT = createField(DSL.name("content"), org.jooq.impl.SQLDataType.CLOB.nullable(false), this, "内容"); + + /** + * The column t_uni_notice.publish_time. 发布时间 + */ + public final TableField PUBLISH_TIME = createField(DSL.name("publish_time"), org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "发布时间"); + + /** + * The column t_uni_notice.state. 0草稿,1发布 + */ + public final TableField STATE = createField(DSL.name("state"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "0草稿,1发布"); + + /** + * The column t_uni_notice.lang. 语言 + */ + public final TableField LANG = createField(DSL.name("lang"), org.jooq.impl.SQLDataType.VARCHAR(10).nullable(false).defaultValue(org.jooq.impl.DSL.inline("", org.jooq.impl.SQLDataType.VARCHAR)), this, "语言"); + + /** + * Create a t_uni_notice table reference + */ + public TUniNoticeTable() { + this(DSL.name("t_uni_notice"), null); + } + + /** + * Create an aliased t_uni_notice table reference + */ + public TUniNoticeTable(String alias) { + this(DSL.name(alias), T_UNI_NOTICE); + } + + /** + * Create an aliased t_uni_notice table reference + */ + public TUniNoticeTable(Name alias) { + this(alias, T_UNI_NOTICE); + } + + private TUniNoticeTable(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TUniNoticeTable(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment("公告")); + } + + public TUniNoticeTable(Table child, ForeignKey key) { + super(child, key, T_UNI_NOTICE); + } + + @Override + public Schema getSchema() { + return DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.T_UNI_NOTICE_PRIMARY); + } + + @Override + public Identity getIdentity() { + return Keys.IDENTITY_T_UNI_NOTICE; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_T_UNI_NOTICE_PRIMARY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_T_UNI_NOTICE_PRIMARY); + } + + @Override + public TUniNoticeTable as(String alias) { + return new TUniNoticeTable(DSL.name(alias), this); + } + + @Override + public TUniNoticeTable as(Name alias) { + return new TUniNoticeTable(alias, this); + } + + /** + * Rename this table + */ + @Override + public TUniNoticeTable rename(String name) { + return new TUniNoticeTable(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TUniNoticeTable rename(Name name) { + return new TUniNoticeTable(name, null); + } + + // ------------------------------------------------------------------------- + // Row9 type methods + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityConfigPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityConfigPojo.java new file mode 100644 index 0000000..e6e3e10 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityConfigPojo.java @@ -0,0 +1,242 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 活动配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityConfigPojo implements Serializable { + + private static final long serialVersionUID = 826912231; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String title; + private String titleContent; + private String activityImg; + private String activityUrl; + private Integer state; + private BigDecimal amount; + private BigDecimal superiorAmount; + private Integer activityNumber; + private Integer category; + private Integer type; + private String mark; + + public ActivityConfigPojo() {} + + public ActivityConfigPojo(ActivityConfigPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.title = value.title; + this.titleContent = value.titleContent; + this.activityImg = value.activityImg; + this.activityUrl = value.activityUrl; + this.state = value.state; + this.amount = value.amount; + this.superiorAmount = value.superiorAmount; + this.activityNumber = value.activityNumber; + this.category = value.category; + this.type = value.type; + this.mark = value.mark; + } + + public ActivityConfigPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String title, + String titleContent, + String activityImg, + String activityUrl, + Integer state, + BigDecimal amount, + BigDecimal superiorAmount, + Integer activityNumber, + Integer category, + Integer type, + String mark + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.title = title; + this.titleContent = titleContent; + this.activityImg = activityImg; + this.activityUrl = activityUrl; + this.state = state; + this.amount = amount; + this.superiorAmount = superiorAmount; + this.activityNumber = activityNumber; + this.category = category; + this.type = type; + this.mark = mark; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitleContent() { + return this.titleContent; + } + + public void setTitleContent(String titleContent) { + this.titleContent = titleContent; + } + + public String getActivityImg() { + return this.activityImg; + } + + public void setActivityImg(String activityImg) { + this.activityImg = activityImg; + } + + public String getActivityUrl() { + return this.activityUrl; + } + + public void setActivityUrl(String activityUrl) { + this.activityUrl = activityUrl; + } + + public Integer getState() { + return this.state; + } + + public void setState(Integer state) { + this.state = state; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BigDecimal getSuperiorAmount() { + return this.superiorAmount; + } + + public void setSuperiorAmount(BigDecimal superiorAmount) { + this.superiorAmount = superiorAmount; + } + + public Integer getActivityNumber() { + return this.activityNumber; + } + + public void setActivityNumber(Integer activityNumber) { + this.activityNumber = activityNumber; + } + + public Integer getCategory() { + return this.category; + } + + public void setCategory(Integer category) { + this.category = category; + } + + public Integer getType() { + return this.type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getMark() { + return this.mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ActivityConfigPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(title); + sb.append(", ").append(titleContent); + sb.append(", ").append(activityImg); + sb.append(", ").append(activityUrl); + sb.append(", ").append(state); + sb.append(", ").append(amount); + sb.append(", ").append(superiorAmount); + sb.append(", ").append(activityNumber); + sb.append(", ").append(category); + sb.append(", ").append(type); + sb.append(", ").append(mark); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityLogPojo.java new file mode 100644 index 0000000..d157653 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityLogPojo.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 活动任务日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityLogPojo implements Serializable { + + private static final long serialVersionUID = 2060098221; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer activityConfigId; + private String address; + private String superiorAddress; + private String title; + private Integer type; + private BigDecimal amount; + private BigDecimal superiorAmount; + private Timestamp endTime; + private Integer configType; + private String mark; + private String hashs; + private Integer transferType; + + public ActivityLogPojo() {} + + public ActivityLogPojo(ActivityLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.activityConfigId = value.activityConfigId; + this.address = value.address; + this.superiorAddress = value.superiorAddress; + this.title = value.title; + this.type = value.type; + this.amount = value.amount; + this.superiorAmount = value.superiorAmount; + this.endTime = value.endTime; + this.configType = value.configType; + this.mark = value.mark; + this.hashs = value.hashs; + this.transferType = value.transferType; + } + + public ActivityLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer activityConfigId, + String address, + String superiorAddress, + String title, + Integer type, + BigDecimal amount, + BigDecimal superiorAmount, + Timestamp endTime, + Integer configType, + String mark, + String hashs, + Integer transferType + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.activityConfigId = activityConfigId; + this.address = address; + this.superiorAddress = superiorAddress; + this.title = title; + this.type = type; + this.amount = amount; + this.superiorAmount = superiorAmount; + this.endTime = endTime; + this.configType = configType; + this.mark = mark; + this.hashs = hashs; + this.transferType = transferType; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getActivityConfigId() { + return this.activityConfigId; + } + + public void setActivityConfigId(Integer activityConfigId) { + this.activityConfigId = activityConfigId; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getSuperiorAddress() { + return this.superiorAddress; + } + + public void setSuperiorAddress(String superiorAddress) { + this.superiorAddress = superiorAddress; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getType() { + return this.type; + } + + public void setType(Integer type) { + this.type = type; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BigDecimal getSuperiorAmount() { + return this.superiorAmount; + } + + public void setSuperiorAmount(BigDecimal superiorAmount) { + this.superiorAmount = superiorAmount; + } + + public Timestamp getEndTime() { + return this.endTime; + } + + public void setEndTime(Timestamp endTime) { + this.endTime = endTime; + } + + public Integer getConfigType() { + return this.configType; + } + + public void setConfigType(Integer configType) { + this.configType = configType; + } + + public String getMark() { + return this.mark; + } + + public void setMark(String mark) { + this.mark = mark; + } + + public String getHashs() { + return this.hashs; + } + + public void setHashs(String hashs) { + this.hashs = hashs; + } + + public Integer getTransferType() { + return this.transferType; + } + + public void setTransferType(Integer transferType) { + this.transferType = transferType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ActivityLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(activityConfigId); + sb.append(", ").append(address); + sb.append(", ").append(superiorAddress); + sb.append(", ").append(title); + sb.append(", ").append(type); + sb.append(", ").append(amount); + sb.append(", ").append(superiorAmount); + sb.append(", ").append(endTime); + sb.append(", ").append(configType); + sb.append(", ").append(mark); + sb.append(", ").append(hashs); + sb.append(", ").append(transferType); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityStatisticsPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityStatisticsPojo.java new file mode 100644 index 0000000..1b178ac --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ActivityStatisticsPojo.java @@ -0,0 +1,125 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 业绩统计 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityStatisticsPojo implements Serializable { + + private static final long serialVersionUID = -793383674; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String address; + private BigDecimal amount; + + public ActivityStatisticsPojo() {} + + public ActivityStatisticsPojo(ActivityStatisticsPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.address = value.address; + this.amount = value.amount; + } + + public ActivityStatisticsPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String address, + BigDecimal amount + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.address = address; + this.amount = amount; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ActivityStatisticsPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(address); + sb.append(", ").append(amount); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ChainLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ChainLogPojo.java new file mode 100644 index 0000000..d51a91e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/ChainLogPojo.java @@ -0,0 +1,163 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 链日志同步 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ChainLogPojo implements Serializable { + + private static final long serialVersionUID = 1502409996; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String blockNumber; + private String hash; + private String chainName; + private String dataValue; + private String transactionHash; + + public ChainLogPojo() {} + + public ChainLogPojo(ChainLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.blockNumber = value.blockNumber; + this.hash = value.hash; + this.chainName = value.chainName; + this.dataValue = value.dataValue; + this.transactionHash = value.transactionHash; + } + + public ChainLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String blockNumber, + String hash, + String chainName, + String dataValue, + String transactionHash + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.blockNumber = blockNumber; + this.hash = hash; + this.chainName = chainName; + this.dataValue = dataValue; + this.transactionHash = transactionHash; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getBlockNumber() { + return this.blockNumber; + } + + public void setBlockNumber(String blockNumber) { + this.blockNumber = blockNumber; + } + + public String getHash() { + return this.hash; + } + + public void setHash(String hash) { + this.hash = hash; + } + + public String getChainName() { + return this.chainName; + } + + public void setChainName(String chainName) { + this.chainName = chainName; + } + + public String getDataValue() { + return this.dataValue; + } + + public void setDataValue(String dataValue) { + this.dataValue = dataValue; + } + + public String getTransactionHash() { + return this.transactionHash; + } + + public void setTransactionHash(String transactionHash) { + this.transactionHash = transactionHash; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ChainLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(blockNumber); + sb.append(", ").append(hash); + sb.append(", ").append(chainName); + sb.append(", ").append(dataValue); + sb.append(", ").append(transactionHash); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/CoinConfigPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/CoinConfigPojo.java new file mode 100644 index 0000000..76bd39f --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/CoinConfigPojo.java @@ -0,0 +1,203 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 币种配置表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class CoinConfigPojo implements Serializable { + + private static final long serialVersionUID = -1974194901; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String coinName; + private Integer state; + private BigDecimal usdtPrice; + private BigDecimal minNumber; + private BigDecimal maxNumber; + private BigDecimal airdropNumber; + private BigDecimal privatePlacement; + private BigDecimal toPrivatePlacement; + + public CoinConfigPojo() {} + + public CoinConfigPojo(CoinConfigPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.coinName = value.coinName; + this.state = value.state; + this.usdtPrice = value.usdtPrice; + this.minNumber = value.minNumber; + this.maxNumber = value.maxNumber; + this.airdropNumber = value.airdropNumber; + this.privatePlacement = value.privatePlacement; + this.toPrivatePlacement = value.toPrivatePlacement; + } + + public CoinConfigPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String coinName, + Integer state, + BigDecimal usdtPrice, + BigDecimal minNumber, + BigDecimal maxNumber, + BigDecimal airdropNumber, + BigDecimal privatePlacement, + BigDecimal toPrivatePlacement + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.coinName = coinName; + this.state = state; + this.usdtPrice = usdtPrice; + this.minNumber = minNumber; + this.maxNumber = maxNumber; + this.airdropNumber = airdropNumber; + this.privatePlacement = privatePlacement; + this.toPrivatePlacement = toPrivatePlacement; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getCoinName() { + return this.coinName; + } + + public void setCoinName(String coinName) { + this.coinName = coinName; + } + + public Integer getState() { + return this.state; + } + + public void setState(Integer state) { + this.state = state; + } + + public BigDecimal getUsdtPrice() { + return this.usdtPrice; + } + + public void setUsdtPrice(BigDecimal usdtPrice) { + this.usdtPrice = usdtPrice; + } + + public BigDecimal getMinNumber() { + return this.minNumber; + } + + public void setMinNumber(BigDecimal minNumber) { + this.minNumber = minNumber; + } + + public BigDecimal getMaxNumber() { + return this.maxNumber; + } + + public void setMaxNumber(BigDecimal maxNumber) { + this.maxNumber = maxNumber; + } + + public BigDecimal getAirdropNumber() { + return this.airdropNumber; + } + + public void setAirdropNumber(BigDecimal airdropNumber) { + this.airdropNumber = airdropNumber; + } + + public BigDecimal getPrivatePlacement() { + return this.privatePlacement; + } + + public void setPrivatePlacement(BigDecimal privatePlacement) { + this.privatePlacement = privatePlacement; + } + + public BigDecimal getToPrivatePlacement() { + return this.toPrivatePlacement; + } + + public void setToPrivatePlacement(BigDecimal toPrivatePlacement) { + this.toPrivatePlacement = toPrivatePlacement; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("CoinConfigPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(coinName); + sb.append(", ").append(state); + sb.append(", ").append(usdtPrice); + sb.append(", ").append(minNumber); + sb.append(", ").append(maxNumber); + sb.append(", ").append(airdropNumber); + sb.append(", ").append(privatePlacement); + sb.append(", ").append(toPrivatePlacement); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeAwardSettingPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeAwardSettingPojo.java new file mode 100644 index 0000000..32235f7 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeAwardSettingPojo.java @@ -0,0 +1,216 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 节点奖励设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeAwardSettingPojo implements Serializable { + + private static final long serialVersionUID = 452627873; + + private Integer id; + private Timestamp createTime; + private String createBy; + private Timestamp updateTime; + private String updateBy; + private Integer nodeSettingId; + private BigDecimal rebate; + private BigDecimal rbitAmount; + private BigDecimal rbitOne; + private BigDecimal rebateTwo; + private BigDecimal nftAmount; + private BigDecimal nftOne; + private BigDecimal nftTwo; + + public NodeAwardSettingPojo() {} + + public NodeAwardSettingPojo(NodeAwardSettingPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.createBy = value.createBy; + this.updateTime = value.updateTime; + this.updateBy = value.updateBy; + this.nodeSettingId = value.nodeSettingId; + this.rebate = value.rebate; + this.rbitAmount = value.rbitAmount; + this.rbitOne = value.rbitOne; + this.rebateTwo = value.rebateTwo; + this.nftAmount = value.nftAmount; + this.nftOne = value.nftOne; + this.nftTwo = value.nftTwo; + } + + public NodeAwardSettingPojo( + Integer id, + Timestamp createTime, + String createBy, + Timestamp updateTime, + String updateBy, + Integer nodeSettingId, + BigDecimal rebate, + BigDecimal rbitAmount, + BigDecimal rbitOne, + BigDecimal rebateTwo, + BigDecimal nftAmount, + BigDecimal nftOne, + BigDecimal nftTwo + ) { + this.id = id; + this.createTime = createTime; + this.createBy = createBy; + this.updateTime = updateTime; + this.updateBy = updateBy; + this.nodeSettingId = nodeSettingId; + this.rebate = rebate; + this.rbitAmount = rbitAmount; + this.rbitOne = rbitOne; + this.rebateTwo = rebateTwo; + this.nftAmount = nftAmount; + this.nftOne = nftOne; + this.nftTwo = nftTwo; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Integer getNodeSettingId() { + return this.nodeSettingId; + } + + public void setNodeSettingId(Integer nodeSettingId) { + this.nodeSettingId = nodeSettingId; + } + + public BigDecimal getRebate() { + return this.rebate; + } + + public void setRebate(BigDecimal rebate) { + this.rebate = rebate; + } + + public BigDecimal getRbitAmount() { + return this.rbitAmount; + } + + public void setRbitAmount(BigDecimal rbitAmount) { + this.rbitAmount = rbitAmount; + } + + public BigDecimal getRbitOne() { + return this.rbitOne; + } + + public void setRbitOne(BigDecimal rbitOne) { + this.rbitOne = rbitOne; + } + + public BigDecimal getRebateTwo() { + return this.rebateTwo; + } + + public void setRebateTwo(BigDecimal rebateTwo) { + this.rebateTwo = rebateTwo; + } + + public BigDecimal getNftAmount() { + return this.nftAmount; + } + + public void setNftAmount(BigDecimal nftAmount) { + this.nftAmount = nftAmount; + } + + public BigDecimal getNftOne() { + return this.nftOne; + } + + public void setNftOne(BigDecimal nftOne) { + this.nftOne = nftOne; + } + + public BigDecimal getNftTwo() { + return this.nftTwo; + } + + public void setNftTwo(BigDecimal nftTwo) { + this.nftTwo = nftTwo; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodeAwardSettingPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(createBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(nodeSettingId); + sb.append(", ").append(rebate); + sb.append(", ").append(rbitAmount); + sb.append(", ").append(rbitOne); + sb.append(", ").append(rebateTwo); + sb.append(", ").append(nftAmount); + sb.append(", ").append(nftOne); + sb.append(", ").append(nftTwo); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeBuyLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeBuyLogPojo.java new file mode 100644 index 0000000..4c1fee4 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeBuyLogPojo.java @@ -0,0 +1,398 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 节点认购记录 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeBuyLogPojo implements Serializable { + + private static final long serialVersionUID = 614070508; + + private Integer id; + private Timestamp createTime; + private String createBy; + private Timestamp updateTime; + private String updateBy; + private String walletAddress; + private Integer recommendId; + private Integer indirectUserId; + private BigDecimal buyCount; + private String payCoin; + private BigDecimal buyAmount; + private Integer nodeSettingId; + private Integer status; + private Integer userId; + private String hash; + private String orderNumber; + private String inputAddress; + private String outAddress; + private BigDecimal rebate; + private BigDecimal rbitAmount; + private BigDecimal rbitOne; + private BigDecimal rbitTwo; + private BigDecimal nftAmount; + private BigDecimal nftOne; + private BigDecimal nftTwo; + private String illustrate; + private Integer topSettlement; + + public NodeBuyLogPojo() {} + + public NodeBuyLogPojo(NodeBuyLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.createBy = value.createBy; + this.updateTime = value.updateTime; + this.updateBy = value.updateBy; + this.walletAddress = value.walletAddress; + this.recommendId = value.recommendId; + this.indirectUserId = value.indirectUserId; + this.buyCount = value.buyCount; + this.payCoin = value.payCoin; + this.buyAmount = value.buyAmount; + this.nodeSettingId = value.nodeSettingId; + this.status = value.status; + this.userId = value.userId; + this.hash = value.hash; + this.orderNumber = value.orderNumber; + this.inputAddress = value.inputAddress; + this.outAddress = value.outAddress; + this.rebate = value.rebate; + this.rbitAmount = value.rbitAmount; + this.rbitOne = value.rbitOne; + this.rbitTwo = value.rbitTwo; + this.nftAmount = value.nftAmount; + this.nftOne = value.nftOne; + this.nftTwo = value.nftTwo; + this.illustrate = value.illustrate; + this.topSettlement = value.topSettlement; + } + + public NodeBuyLogPojo( + Integer id, + Timestamp createTime, + String createBy, + Timestamp updateTime, + String updateBy, + String walletAddress, + Integer recommendId, + Integer indirectUserId, + BigDecimal buyCount, + String payCoin, + BigDecimal buyAmount, + Integer nodeSettingId, + Integer status, + Integer userId, + String hash, + String orderNumber, + String inputAddress, + String outAddress, + BigDecimal rebate, + BigDecimal rbitAmount, + BigDecimal rbitOne, + BigDecimal rbitTwo, + BigDecimal nftAmount, + BigDecimal nftOne, + BigDecimal nftTwo, + String illustrate, + Integer topSettlement + ) { + this.id = id; + this.createTime = createTime; + this.createBy = createBy; + this.updateTime = updateTime; + this.updateBy = updateBy; + this.walletAddress = walletAddress; + this.recommendId = recommendId; + this.indirectUserId = indirectUserId; + this.buyCount = buyCount; + this.payCoin = payCoin; + this.buyAmount = buyAmount; + this.nodeSettingId = nodeSettingId; + this.status = status; + this.userId = userId; + this.hash = hash; + this.orderNumber = orderNumber; + this.inputAddress = inputAddress; + this.outAddress = outAddress; + this.rebate = rebate; + this.rbitAmount = rbitAmount; + this.rbitOne = rbitOne; + this.rbitTwo = rbitTwo; + this.nftAmount = nftAmount; + this.nftOne = nftOne; + this.nftTwo = nftTwo; + this.illustrate = illustrate; + this.topSettlement = topSettlement; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getWalletAddress() { + return this.walletAddress; + } + + public void setWalletAddress(String walletAddress) { + this.walletAddress = walletAddress; + } + + public Integer getRecommendId() { + return this.recommendId; + } + + public void setRecommendId(Integer recommendId) { + this.recommendId = recommendId; + } + + public Integer getIndirectUserId() { + return this.indirectUserId; + } + + public void setIndirectUserId(Integer indirectUserId) { + this.indirectUserId = indirectUserId; + } + + public BigDecimal getBuyCount() { + return this.buyCount; + } + + public void setBuyCount(BigDecimal buyCount) { + this.buyCount = buyCount; + } + + public String getPayCoin() { + return this.payCoin; + } + + public void setPayCoin(String payCoin) { + this.payCoin = payCoin; + } + + public BigDecimal getBuyAmount() { + return this.buyAmount; + } + + public void setBuyAmount(BigDecimal buyAmount) { + this.buyAmount = buyAmount; + } + + public Integer getNodeSettingId() { + return this.nodeSettingId; + } + + public void setNodeSettingId(Integer nodeSettingId) { + this.nodeSettingId = nodeSettingId; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getUserId() { + return this.userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getHash() { + return this.hash; + } + + public void setHash(String hash) { + this.hash = hash; + } + + public String getOrderNumber() { + return this.orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getInputAddress() { + return this.inputAddress; + } + + public void setInputAddress(String inputAddress) { + this.inputAddress = inputAddress; + } + + public String getOutAddress() { + return this.outAddress; + } + + public void setOutAddress(String outAddress) { + this.outAddress = outAddress; + } + + public BigDecimal getRebate() { + return this.rebate; + } + + public void setRebate(BigDecimal rebate) { + this.rebate = rebate; + } + + public BigDecimal getRbitAmount() { + return this.rbitAmount; + } + + public void setRbitAmount(BigDecimal rbitAmount) { + this.rbitAmount = rbitAmount; + } + + public BigDecimal getRbitOne() { + return this.rbitOne; + } + + public void setRbitOne(BigDecimal rbitOne) { + this.rbitOne = rbitOne; + } + + public BigDecimal getRbitTwo() { + return this.rbitTwo; + } + + public void setRbitTwo(BigDecimal rbitTwo) { + this.rbitTwo = rbitTwo; + } + + public BigDecimal getNftAmount() { + return this.nftAmount; + } + + public void setNftAmount(BigDecimal nftAmount) { + this.nftAmount = nftAmount; + } + + public BigDecimal getNftOne() { + return this.nftOne; + } + + public void setNftOne(BigDecimal nftOne) { + this.nftOne = nftOne; + } + + public BigDecimal getNftTwo() { + return this.nftTwo; + } + + public void setNftTwo(BigDecimal nftTwo) { + this.nftTwo = nftTwo; + } + + public String getIllustrate() { + return this.illustrate; + } + + public void setIllustrate(String illustrate) { + this.illustrate = illustrate; + } + + public Integer getTopSettlement() { + return this.topSettlement; + } + + public void setTopSettlement(Integer topSettlement) { + this.topSettlement = topSettlement; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodeBuyLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(createBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(walletAddress); + sb.append(", ").append(recommendId); + sb.append(", ").append(indirectUserId); + sb.append(", ").append(buyCount); + sb.append(", ").append(payCoin); + sb.append(", ").append(buyAmount); + sb.append(", ").append(nodeSettingId); + sb.append(", ").append(status); + sb.append(", ").append(userId); + sb.append(", ").append(hash); + sb.append(", ").append(orderNumber); + sb.append(", ").append(inputAddress); + sb.append(", ").append(outAddress); + sb.append(", ").append(rebate); + sb.append(", ").append(rbitAmount); + sb.append(", ").append(rbitOne); + sb.append(", ").append(rbitTwo); + sb.append(", ").append(nftAmount); + sb.append(", ").append(nftOne); + sb.append(", ").append(nftTwo); + sb.append(", ").append(illustrate); + sb.append(", ").append(topSettlement); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodePojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodePojo.java new file mode 100644 index 0000000..ae2c333 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodePojo.java @@ -0,0 +1,216 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 用户节点表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodePojo implements Serializable { + + private static final long serialVersionUID = 1233200936; + + private Integer id; + private Timestamp createTime; + private String createBy; + private Timestamp updateTime; + private String updateBy; + private String buyCoin; + private BigDecimal buyAmount; + private Integer buyNumber; + private Timestamp confirmTime; + private Integer userId; + private String nodeName; + private String orderNumber; + private Integer nodeSettingId; + + public NodePojo() {} + + public NodePojo(NodePojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.createBy = value.createBy; + this.updateTime = value.updateTime; + this.updateBy = value.updateBy; + this.buyCoin = value.buyCoin; + this.buyAmount = value.buyAmount; + this.buyNumber = value.buyNumber; + this.confirmTime = value.confirmTime; + this.userId = value.userId; + this.nodeName = value.nodeName; + this.orderNumber = value.orderNumber; + this.nodeSettingId = value.nodeSettingId; + } + + public NodePojo( + Integer id, + Timestamp createTime, + String createBy, + Timestamp updateTime, + String updateBy, + String buyCoin, + BigDecimal buyAmount, + Integer buyNumber, + Timestamp confirmTime, + Integer userId, + String nodeName, + String orderNumber, + Integer nodeSettingId + ) { + this.id = id; + this.createTime = createTime; + this.createBy = createBy; + this.updateTime = updateTime; + this.updateBy = updateBy; + this.buyCoin = buyCoin; + this.buyAmount = buyAmount; + this.buyNumber = buyNumber; + this.confirmTime = confirmTime; + this.userId = userId; + this.nodeName = nodeName; + this.orderNumber = orderNumber; + this.nodeSettingId = nodeSettingId; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getBuyCoin() { + return this.buyCoin; + } + + public void setBuyCoin(String buyCoin) { + this.buyCoin = buyCoin; + } + + public BigDecimal getBuyAmount() { + return this.buyAmount; + } + + public void setBuyAmount(BigDecimal buyAmount) { + this.buyAmount = buyAmount; + } + + public Integer getBuyNumber() { + return this.buyNumber; + } + + public void setBuyNumber(Integer buyNumber) { + this.buyNumber = buyNumber; + } + + public Timestamp getConfirmTime() { + return this.confirmTime; + } + + public void setConfirmTime(Timestamp confirmTime) { + this.confirmTime = confirmTime; + } + + public Integer getUserId() { + return this.userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getNodeName() { + return this.nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getOrderNumber() { + return this.orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public Integer getNodeSettingId() { + return this.nodeSettingId; + } + + public void setNodeSettingId(Integer nodeSettingId) { + this.nodeSettingId = nodeSettingId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodePojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(createBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(buyCoin); + sb.append(", ").append(buyAmount); + sb.append(", ").append(buyNumber); + sb.append(", ").append(confirmTime); + sb.append(", ").append(userId); + sb.append(", ").append(nodeName); + sb.append(", ").append(orderNumber); + sb.append(", ").append(nodeSettingId); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeSettingPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeSettingPojo.java new file mode 100644 index 0000000..c64b10d --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeSettingPojo.java @@ -0,0 +1,255 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 节点设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeSettingPojo implements Serializable { + + private static final long serialVersionUID = -1476691260; + + private Integer id; + private Timestamp createTime; + private String createBy; + private Timestamp updateTime; + private String updateBy; + private String buyCoinName; + private Integer nodeTotal; + private BigDecimal nodePrice; + private Integer purchaseLimit; + private Integer purchasedCount; + private BigDecimal purchasedAmount; + private Integer status; + private String nodeName; + private String illustrate; + private String title; + private String nodeGrade; + + public NodeSettingPojo() {} + + public NodeSettingPojo(NodeSettingPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.createBy = value.createBy; + this.updateTime = value.updateTime; + this.updateBy = value.updateBy; + this.buyCoinName = value.buyCoinName; + this.nodeTotal = value.nodeTotal; + this.nodePrice = value.nodePrice; + this.purchaseLimit = value.purchaseLimit; + this.purchasedCount = value.purchasedCount; + this.purchasedAmount = value.purchasedAmount; + this.status = value.status; + this.nodeName = value.nodeName; + this.illustrate = value.illustrate; + this.title = value.title; + this.nodeGrade = value.nodeGrade; + } + + public NodeSettingPojo( + Integer id, + Timestamp createTime, + String createBy, + Timestamp updateTime, + String updateBy, + String buyCoinName, + Integer nodeTotal, + BigDecimal nodePrice, + Integer purchaseLimit, + Integer purchasedCount, + BigDecimal purchasedAmount, + Integer status, + String nodeName, + String illustrate, + String title, + String nodeGrade + ) { + this.id = id; + this.createTime = createTime; + this.createBy = createBy; + this.updateTime = updateTime; + this.updateBy = updateBy; + this.buyCoinName = buyCoinName; + this.nodeTotal = nodeTotal; + this.nodePrice = nodePrice; + this.purchaseLimit = purchaseLimit; + this.purchasedCount = purchasedCount; + this.purchasedAmount = purchasedAmount; + this.status = status; + this.nodeName = nodeName; + this.illustrate = illustrate; + this.title = title; + this.nodeGrade = nodeGrade; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getBuyCoinName() { + return this.buyCoinName; + } + + public void setBuyCoinName(String buyCoinName) { + this.buyCoinName = buyCoinName; + } + + public Integer getNodeTotal() { + return this.nodeTotal; + } + + public void setNodeTotal(Integer nodeTotal) { + this.nodeTotal = nodeTotal; + } + + public BigDecimal getNodePrice() { + return this.nodePrice; + } + + public void setNodePrice(BigDecimal nodePrice) { + this.nodePrice = nodePrice; + } + + public Integer getPurchaseLimit() { + return this.purchaseLimit; + } + + public void setPurchaseLimit(Integer purchaseLimit) { + this.purchaseLimit = purchaseLimit; + } + + public Integer getPurchasedCount() { + return this.purchasedCount; + } + + public void setPurchasedCount(Integer purchasedCount) { + this.purchasedCount = purchasedCount; + } + + public BigDecimal getPurchasedAmount() { + return this.purchasedAmount; + } + + public void setPurchasedAmount(BigDecimal purchasedAmount) { + this.purchasedAmount = purchasedAmount; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getNodeName() { + return this.nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getIllustrate() { + return this.illustrate; + } + + public void setIllustrate(String illustrate) { + this.illustrate = illustrate; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getNodeGrade() { + return this.nodeGrade; + } + + public void setNodeGrade(String nodeGrade) { + this.nodeGrade = nodeGrade; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodeSettingPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(createBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(buyCoinName); + sb.append(", ").append(nodeTotal); + sb.append(", ").append(nodePrice); + sb.append(", ").append(purchaseLimit); + sb.append(", ").append(purchasedCount); + sb.append(", ").append(purchasedAmount); + sb.append(", ").append(status); + sb.append(", ").append(nodeName); + sb.append(", ").append(illustrate); + sb.append(", ").append(title); + sb.append(", ").append(nodeGrade); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskLogPojo.java new file mode 100644 index 0000000..9984373 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskLogPojo.java @@ -0,0 +1,177 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 我的任务奖励 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskLogPojo implements Serializable { + + private static final long serialVersionUID = 355898296; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer taskId; + private Integer memberId; + private Integer state; + private BigDecimal awardValue; + private String coinName; + private BigDecimal recommendValue; + + public NodeTaskLogPojo() {} + + public NodeTaskLogPojo(NodeTaskLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.taskId = value.taskId; + this.memberId = value.memberId; + this.state = value.state; + this.awardValue = value.awardValue; + this.coinName = value.coinName; + this.recommendValue = value.recommendValue; + } + + public NodeTaskLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer taskId, + Integer memberId, + Integer state, + BigDecimal awardValue, + String coinName, + BigDecimal recommendValue + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.taskId = taskId; + this.memberId = memberId; + this.state = state; + this.awardValue = awardValue; + this.coinName = coinName; + this.recommendValue = recommendValue; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getTaskId() { + return this.taskId; + } + + public void setTaskId(Integer taskId) { + this.taskId = taskId; + } + + public Integer getMemberId() { + return this.memberId; + } + + public void setMemberId(Integer memberId) { + this.memberId = memberId; + } + + public Integer getState() { + return this.state; + } + + public void setState(Integer state) { + this.state = state; + } + + public BigDecimal getAwardValue() { + return this.awardValue; + } + + public void setAwardValue(BigDecimal awardValue) { + this.awardValue = awardValue; + } + + public String getCoinName() { + return this.coinName; + } + + public void setCoinName(String coinName) { + this.coinName = coinName; + } + + public BigDecimal getRecommendValue() { + return this.recommendValue; + } + + public void setRecommendValue(BigDecimal recommendValue) { + this.recommendValue = recommendValue; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodeTaskLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(taskId); + sb.append(", ").append(memberId); + sb.append(", ").append(state); + sb.append(", ").append(awardValue); + sb.append(", ").append(coinName); + sb.append(", ").append(recommendValue); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskPojo.java new file mode 100644 index 0000000..9a93599 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/NodeTaskPojo.java @@ -0,0 +1,177 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * NEER任务配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskPojo implements Serializable { + + private static final long serialVersionUID = 1740748316; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer type; + private String title; + private BigDecimal awardValue; + private BigDecimal recommendValue; + private Integer type2Target; + private Integer coinId; + + public NodeTaskPojo() {} + + public NodeTaskPojo(NodeTaskPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.type = value.type; + this.title = value.title; + this.awardValue = value.awardValue; + this.recommendValue = value.recommendValue; + this.type2Target = value.type2Target; + this.coinId = value.coinId; + } + + public NodeTaskPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer type, + String title, + BigDecimal awardValue, + BigDecimal recommendValue, + Integer type2Target, + Integer coinId + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.type = type; + this.title = title; + this.awardValue = awardValue; + this.recommendValue = recommendValue; + this.type2Target = type2Target; + this.coinId = coinId; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getType() { + return this.type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public BigDecimal getAwardValue() { + return this.awardValue; + } + + public void setAwardValue(BigDecimal awardValue) { + this.awardValue = awardValue; + } + + public BigDecimal getRecommendValue() { + return this.recommendValue; + } + + public void setRecommendValue(BigDecimal recommendValue) { + this.recommendValue = recommendValue; + } + + public Integer getType2Target() { + return this.type2Target; + } + + public void setType2Target(Integer type2Target) { + this.type2Target = type2Target; + } + + public Integer getCoinId() { + return this.coinId; + } + + public void setCoinId(Integer coinId) { + this.coinId = coinId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("NodeTaskPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(type); + sb.append(", ").append(title); + sb.append(", ").append(awardValue); + sb.append(", ").append(recommendValue); + sb.append(", ").append(type2Target); + sb.append(", ").append(coinId); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/PayCoinLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/PayCoinLogPojo.java new file mode 100644 index 0000000..2356ae5 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/PayCoinLogPojo.java @@ -0,0 +1,242 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 兑换币种日志表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class PayCoinLogPojo implements Serializable { + + private static final long serialVersionUID = 1228528678; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer memberId; + private String address; + private Integer coinId; + private String coinName; + private BigDecimal payUsdt; + private BigDecimal amount; + private BigDecimal unitPrice; + private Integer status; + private String hash; + private String orderNumber; + private String illustrate; + + public PayCoinLogPojo() {} + + public PayCoinLogPojo(PayCoinLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.memberId = value.memberId; + this.address = value.address; + this.coinId = value.coinId; + this.coinName = value.coinName; + this.payUsdt = value.payUsdt; + this.amount = value.amount; + this.unitPrice = value.unitPrice; + this.status = value.status; + this.hash = value.hash; + this.orderNumber = value.orderNumber; + this.illustrate = value.illustrate; + } + + public PayCoinLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer memberId, + String address, + Integer coinId, + String coinName, + BigDecimal payUsdt, + BigDecimal amount, + BigDecimal unitPrice, + Integer status, + String hash, + String orderNumber, + String illustrate + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.memberId = memberId; + this.address = address; + this.coinId = coinId; + this.coinName = coinName; + this.payUsdt = payUsdt; + this.amount = amount; + this.unitPrice = unitPrice; + this.status = status; + this.hash = hash; + this.orderNumber = orderNumber; + this.illustrate = illustrate; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getMemberId() { + return this.memberId; + } + + public void setMemberId(Integer memberId) { + this.memberId = memberId; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getCoinId() { + return this.coinId; + } + + public void setCoinId(Integer coinId) { + this.coinId = coinId; + } + + public String getCoinName() { + return this.coinName; + } + + public void setCoinName(String coinName) { + this.coinName = coinName; + } + + public BigDecimal getPayUsdt() { + return this.payUsdt; + } + + public void setPayUsdt(BigDecimal payUsdt) { + this.payUsdt = payUsdt; + } + + public BigDecimal getAmount() { + return this.amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BigDecimal getUnitPrice() { + return this.unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getHash() { + return this.hash; + } + + public void setHash(String hash) { + this.hash = hash; + } + + public String getOrderNumber() { + return this.orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getIllustrate() { + return this.illustrate; + } + + public void setIllustrate(String illustrate) { + this.illustrate = illustrate; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PayCoinLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(memberId); + sb.append(", ").append(address); + sb.append(", ").append(coinId); + sb.append(", ").append(coinName); + sb.append(", ").append(payUsdt); + sb.append(", ").append(amount); + sb.append(", ").append(unitPrice); + sb.append(", ").append(status); + sb.append(", ").append(hash); + sb.append(", ").append(orderNumber); + sb.append(", ").append(illustrate); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysAccountPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysAccountPojo.java new file mode 100644 index 0000000..3f8d70b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysAccountPojo.java @@ -0,0 +1,189 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 系统账户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysAccountPojo implements Serializable { + + private static final long serialVersionUID = -488057523; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String account; + private String name; + private String password; + private Byte status; + private String email; + private Integer roleId; + private String address; + + public SysAccountPojo() {} + + public SysAccountPojo(SysAccountPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.account = value.account; + this.name = value.name; + this.password = value.password; + this.status = value.status; + this.email = value.email; + this.roleId = value.roleId; + this.address = value.address; + } + + public SysAccountPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String account, + String name, + String password, + Byte status, + String email, + Integer roleId, + String address + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.account = account; + this.name = name; + this.password = password; + this.status = status; + this.email = email; + this.roleId = roleId; + this.address = address; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getAccount() { + return this.account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Byte getStatus() { + return this.status; + } + + public void setStatus(Byte status) { + this.status = status; + } + + public String getEmail() { + return this.email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Integer getRoleId() { + return this.roleId; + } + + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("SysAccountPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(account); + sb.append(", ").append(name); + sb.append(", ").append(password); + sb.append(", ").append(status); + sb.append(", ").append(email); + sb.append(", ").append(roleId); + sb.append(", ").append(address); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysActionLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysActionLogPojo.java new file mode 100644 index 0000000..8e9230b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysActionLogPojo.java @@ -0,0 +1,202 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 系统操作日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysActionLogPojo implements Serializable { + + private static final long serialVersionUID = -595137174; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private String createBy; + private Byte flag; + private Integer accountId; + private String action; + private String actionUri; + private String actionParams; + private Timestamp actionTime; + private String userAgent; + private String ip; + + public SysActionLogPojo() {} + + public SysActionLogPojo(SysActionLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.createBy = value.createBy; + this.flag = value.flag; + this.accountId = value.accountId; + this.action = value.action; + this.actionUri = value.actionUri; + this.actionParams = value.actionParams; + this.actionTime = value.actionTime; + this.userAgent = value.userAgent; + this.ip = value.ip; + } + + public SysActionLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + String createBy, + Byte flag, + Integer accountId, + String action, + String actionUri, + String actionParams, + Timestamp actionTime, + String userAgent, + String ip + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.createBy = createBy; + this.flag = flag; + this.accountId = accountId; + this.action = action; + this.actionUri = actionUri; + this.actionParams = actionParams; + this.actionTime = actionTime; + this.userAgent = userAgent; + this.ip = ip; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getAccountId() { + return this.accountId; + } + + public void setAccountId(Integer accountId) { + this.accountId = accountId; + } + + public String getAction() { + return this.action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getActionUri() { + return this.actionUri; + } + + public void setActionUri(String actionUri) { + this.actionUri = actionUri; + } + + public String getActionParams() { + return this.actionParams; + } + + public void setActionParams(String actionParams) { + this.actionParams = actionParams; + } + + public Timestamp getActionTime() { + return this.actionTime; + } + + public void setActionTime(Timestamp actionTime) { + this.actionTime = actionTime; + } + + public String getUserAgent() { + return this.userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public String getIp() { + return this.ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("SysActionLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(createBy); + sb.append(", ").append(flag); + sb.append(", ").append(accountId); + sb.append(", ").append(action); + sb.append(", ").append(actionUri); + sb.append(", ").append(actionParams); + sb.append(", ").append(actionTime); + sb.append(", ").append(userAgent); + sb.append(", ").append(ip); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysConfigPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysConfigPojo.java new file mode 100644 index 0000000..e6dda22 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysConfigPojo.java @@ -0,0 +1,189 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 一些配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysConfigPojo implements Serializable { + + private static final long serialVersionUID = 80040144; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Byte type; + private String configKey; + private Byte valueType; + private String value; + private String defaultValue; + private String description; + private String defaultDescription; + + public SysConfigPojo() {} + + public SysConfigPojo(SysConfigPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.type = value.type; + this.configKey = value.configKey; + this.valueType = value.valueType; + this.value = value.value; + this.defaultValue = value.defaultValue; + this.description = value.description; + this.defaultDescription = value.defaultDescription; + } + + public SysConfigPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Byte type, + String configKey, + Byte valueType, + String value, + String defaultValue, + String description, + String defaultDescription + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.type = type; + this.configKey = configKey; + this.valueType = valueType; + this.value = value; + this.defaultValue = defaultValue; + this.description = description; + this.defaultDescription = defaultDescription; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Byte getType() { + return this.type; + } + + public void setType(Byte type) { + this.type = type; + } + + public String getConfigKey() { + return this.configKey; + } + + public void setConfigKey(String configKey) { + this.configKey = configKey; + } + + public Byte getValueType() { + return this.valueType; + } + + public void setValueType(Byte valueType) { + this.valueType = valueType; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDefaultValue() { + return this.defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDefaultDescription() { + return this.defaultDescription; + } + + public void setDefaultDescription(String defaultDescription) { + this.defaultDescription = defaultDescription; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("SysConfigPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(type); + sb.append(", ").append(configKey); + sb.append(", ").append(valueType); + sb.append(", ").append(value); + sb.append(", ").append(defaultValue); + sb.append(", ").append(description); + sb.append(", ").append(defaultDescription); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysMenuPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysMenuPojo.java new file mode 100644 index 0000000..bfd66ea --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysMenuPojo.java @@ -0,0 +1,254 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 菜单权限表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysMenuPojo implements Serializable { + + private static final long serialVersionUID = -1651609373; + + private Long menuId; + private String menuName; + private Long parentId; + private Integer orderNum; + private String url; + private String target; + private String menuType; + private String visible; + private String isRefresh; + private String perms; + private String icon; + private String createBy; + private Timestamp createTime; + private String updateBy; + private Timestamp updateTime; + private String remark; + + public SysMenuPojo() {} + + public SysMenuPojo(SysMenuPojo value) { + this.menuId = value.menuId; + this.menuName = value.menuName; + this.parentId = value.parentId; + this.orderNum = value.orderNum; + this.url = value.url; + this.target = value.target; + this.menuType = value.menuType; + this.visible = value.visible; + this.isRefresh = value.isRefresh; + this.perms = value.perms; + this.icon = value.icon; + this.createBy = value.createBy; + this.createTime = value.createTime; + this.updateBy = value.updateBy; + this.updateTime = value.updateTime; + this.remark = value.remark; + } + + public SysMenuPojo( + Long menuId, + String menuName, + Long parentId, + Integer orderNum, + String url, + String target, + String menuType, + String visible, + String isRefresh, + String perms, + String icon, + String createBy, + Timestamp createTime, + String updateBy, + Timestamp updateTime, + String remark + ) { + this.menuId = menuId; + this.menuName = menuName; + this.parentId = parentId; + this.orderNum = orderNum; + this.url = url; + this.target = target; + this.menuType = menuType; + this.visible = visible; + this.isRefresh = isRefresh; + this.perms = perms; + this.icon = icon; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.remark = remark; + } + + public Long getMenuId() { + return this.menuId; + } + + public void setMenuId(Long menuId) { + this.menuId = menuId; + } + + public String getMenuName() { + return this.menuName; + } + + public void setMenuName(String menuName) { + this.menuName = menuName; + } + + public Long getParentId() { + return this.parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public Integer getOrderNum() { + return this.orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public String getUrl() { + return this.url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getTarget() { + return this.target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getMenuType() { + return this.menuType; + } + + public void setMenuType(String menuType) { + this.menuType = menuType; + } + + public String getVisible() { + return this.visible; + } + + public void setVisible(String visible) { + this.visible = visible; + } + + public String getIsRefresh() { + return this.isRefresh; + } + + public void setIsRefresh(String isRefresh) { + this.isRefresh = isRefresh; + } + + public String getPerms() { + return this.perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public String getIcon() { + return this.icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("SysMenuPojo ("); + + sb.append(menuId); + sb.append(", ").append(menuName); + sb.append(", ").append(parentId); + sb.append(", ").append(orderNum); + sb.append(", ").append(url); + sb.append(", ").append(target); + sb.append(", ").append(menuType); + sb.append(", ").append(visible); + sb.append(", ").append(isRefresh); + sb.append(", ").append(perms); + sb.append(", ").append(icon); + sb.append(", ").append(createBy); + sb.append(", ").append(createTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(remark); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysRolePojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysRolePojo.java new file mode 100644 index 0000000..da7ec7d --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/SysRolePojo.java @@ -0,0 +1,202 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 角色信息表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysRolePojo implements Serializable { + + private static final long serialVersionUID = -294676160; + + private Long roleId; + private String roleName; + private String roleKey; + private Integer roleSort; + private String dataScope; + private String status; + private String delFlag; + private String createBy; + private Timestamp createTime; + private String updateBy; + private Timestamp updateTime; + private String remark; + + public SysRolePojo() {} + + public SysRolePojo(SysRolePojo value) { + this.roleId = value.roleId; + this.roleName = value.roleName; + this.roleKey = value.roleKey; + this.roleSort = value.roleSort; + this.dataScope = value.dataScope; + this.status = value.status; + this.delFlag = value.delFlag; + this.createBy = value.createBy; + this.createTime = value.createTime; + this.updateBy = value.updateBy; + this.updateTime = value.updateTime; + this.remark = value.remark; + } + + public SysRolePojo( + Long roleId, + String roleName, + String roleKey, + Integer roleSort, + String dataScope, + String status, + String delFlag, + String createBy, + Timestamp createTime, + String updateBy, + Timestamp updateTime, + String remark + ) { + this.roleId = roleId; + this.roleName = roleName; + this.roleKey = roleKey; + this.roleSort = roleSort; + this.dataScope = dataScope; + this.status = status; + this.delFlag = delFlag; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.remark = remark; + } + + public Long getRoleId() { + return this.roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return this.roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getRoleKey() { + return this.roleKey; + } + + public void setRoleKey(String roleKey) { + this.roleKey = roleKey; + } + + public Integer getRoleSort() { + return this.roleSort; + } + + public void setRoleSort(Integer roleSort) { + this.roleSort = roleSort; + } + + public String getDataScope() { + return this.dataScope; + } + + public void setDataScope(String dataScope) { + this.dataScope = dataScope; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return this.delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return this.createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return this.updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("SysRolePojo ("); + + sb.append(roleId); + sb.append(", ").append(roleName); + sb.append(", ").append(roleKey); + sb.append(", ").append(roleSort); + sb.append(", ").append(dataScope); + sb.append(", ").append(status); + sb.append(", ").append(delFlag); + sb.append(", ").append(createBy); + sb.append(", ").append(createTime); + sb.append(", ").append(updateBy); + sb.append(", ").append(updateTime); + sb.append(", ").append(remark); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberPojo.java new file mode 100644 index 0000000..b268443 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberPojo.java @@ -0,0 +1,384 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 用户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberPojo implements Serializable { + + private static final long serialVersionUID = -585676636; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String account; + private Integer accountType; + private Integer referId; + private String allPid; + private String passwordLogin; + private String passwordPay; + private String shareCode; + private String uid; + private Integer level; + private Integer minLevel; + private Integer shareNum; + private Integer teamNum; + private Integer chainType; + private Integer codePrompt; + private Integer twitterType; + private String twitterId; + private String twitterName; + private String twitterImg; + private String twitterUserName; + private String discordId; + private String tgId; + private Integer topUser; + + public TMemberPojo() {} + + public TMemberPojo(TMemberPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.account = value.account; + this.accountType = value.accountType; + this.referId = value.referId; + this.allPid = value.allPid; + this.passwordLogin = value.passwordLogin; + this.passwordPay = value.passwordPay; + this.shareCode = value.shareCode; + this.uid = value.uid; + this.level = value.level; + this.minLevel = value.minLevel; + this.shareNum = value.shareNum; + this.teamNum = value.teamNum; + this.chainType = value.chainType; + this.codePrompt = value.codePrompt; + this.twitterType = value.twitterType; + this.twitterId = value.twitterId; + this.twitterName = value.twitterName; + this.twitterImg = value.twitterImg; + this.twitterUserName = value.twitterUserName; + this.discordId = value.discordId; + this.tgId = value.tgId; + this.topUser = value.topUser; + } + + public TMemberPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String account, + Integer accountType, + Integer referId, + String allPid, + String passwordLogin, + String passwordPay, + String shareCode, + String uid, + Integer level, + Integer minLevel, + Integer shareNum, + Integer teamNum, + Integer chainType, + Integer codePrompt, + Integer twitterType, + String twitterId, + String twitterName, + String twitterImg, + String twitterUserName, + String discordId, + String tgId, + Integer topUser + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.account = account; + this.accountType = accountType; + this.referId = referId; + this.allPid = allPid; + this.passwordLogin = passwordLogin; + this.passwordPay = passwordPay; + this.shareCode = shareCode; + this.uid = uid; + this.level = level; + this.minLevel = minLevel; + this.shareNum = shareNum; + this.teamNum = teamNum; + this.chainType = chainType; + this.codePrompt = codePrompt; + this.twitterType = twitterType; + this.twitterId = twitterId; + this.twitterName = twitterName; + this.twitterImg = twitterImg; + this.twitterUserName = twitterUserName; + this.discordId = discordId; + this.tgId = tgId; + this.topUser = topUser; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getAccount() { + return this.account; + } + + public void setAccount(String account) { + this.account = account; + } + + public Integer getAccountType() { + return this.accountType; + } + + public void setAccountType(Integer accountType) { + this.accountType = accountType; + } + + public Integer getReferId() { + return this.referId; + } + + public void setReferId(Integer referId) { + this.referId = referId; + } + + public String getAllPid() { + return this.allPid; + } + + public void setAllPid(String allPid) { + this.allPid = allPid; + } + + public String getPasswordLogin() { + return this.passwordLogin; + } + + public void setPasswordLogin(String passwordLogin) { + this.passwordLogin = passwordLogin; + } + + public String getPasswordPay() { + return this.passwordPay; + } + + public void setPasswordPay(String passwordPay) { + this.passwordPay = passwordPay; + } + + public String getShareCode() { + return this.shareCode; + } + + public void setShareCode(String shareCode) { + this.shareCode = shareCode; + } + + public String getUid() { + return this.uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public Integer getLevel() { + return this.level; + } + + public void setLevel(Integer level) { + this.level = level; + } + + public Integer getMinLevel() { + return this.minLevel; + } + + public void setMinLevel(Integer minLevel) { + this.minLevel = minLevel; + } + + public Integer getShareNum() { + return this.shareNum; + } + + public void setShareNum(Integer shareNum) { + this.shareNum = shareNum; + } + + public Integer getTeamNum() { + return this.teamNum; + } + + public void setTeamNum(Integer teamNum) { + this.teamNum = teamNum; + } + + public Integer getChainType() { + return this.chainType; + } + + public void setChainType(Integer chainType) { + this.chainType = chainType; + } + + public Integer getCodePrompt() { + return this.codePrompt; + } + + public void setCodePrompt(Integer codePrompt) { + this.codePrompt = codePrompt; + } + + public Integer getTwitterType() { + return this.twitterType; + } + + public void setTwitterType(Integer twitterType) { + this.twitterType = twitterType; + } + + public String getTwitterId() { + return this.twitterId; + } + + public void setTwitterId(String twitterId) { + this.twitterId = twitterId; + } + + public String getTwitterName() { + return this.twitterName; + } + + public void setTwitterName(String twitterName) { + this.twitterName = twitterName; + } + + public String getTwitterImg() { + return this.twitterImg; + } + + public void setTwitterImg(String twitterImg) { + this.twitterImg = twitterImg; + } + + public String getTwitterUserName() { + return this.twitterUserName; + } + + public void setTwitterUserName(String twitterUserName) { + this.twitterUserName = twitterUserName; + } + + public String getDiscordId() { + return this.discordId; + } + + public void setDiscordId(String discordId) { + this.discordId = discordId; + } + + public String getTgId() { + return this.tgId; + } + + public void setTgId(String tgId) { + this.tgId = tgId; + } + + public Integer getTopUser() { + return this.topUser; + } + + public void setTopUser(Integer topUser) { + this.topUser = topUser; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TMemberPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(account); + sb.append(", ").append(accountType); + sb.append(", ").append(referId); + sb.append(", ").append(allPid); + sb.append(", ").append(passwordLogin); + sb.append(", ").append(passwordPay); + sb.append(", ").append(shareCode); + sb.append(", ").append(uid); + sb.append(", ").append(level); + sb.append(", ").append(minLevel); + sb.append(", ").append(shareNum); + sb.append(", ").append(teamNum); + sb.append(", ").append(chainType); + sb.append(", ").append(codePrompt); + sb.append(", ").append(twitterType); + sb.append(", ").append(twitterId); + sb.append(", ").append(twitterName); + sb.append(", ").append(twitterImg); + sb.append(", ").append(twitterUserName); + sb.append(", ").append(discordId); + sb.append(", ").append(tgId); + sb.append(", ").append(topUser); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberSignPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberSignPojo.java new file mode 100644 index 0000000..a12f1cb --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberSignPojo.java @@ -0,0 +1,137 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 用户签名交易对 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberSignPojo implements Serializable { + + private static final long serialVersionUID = -1871438890; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String address; + private String publicKey; + private String privateKey; + + public TMemberSignPojo() {} + + public TMemberSignPojo(TMemberSignPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.address = value.address; + this.publicKey = value.publicKey; + this.privateKey = value.privateKey; + } + + public TMemberSignPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String address, + String publicKey, + String privateKey + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.address = address; + this.publicKey = publicKey; + this.privateKey = privateKey; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPublicKey() { + return this.publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getPrivateKey() { + return this.privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TMemberSignPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(address); + sb.append(", ").append(publicKey); + sb.append(", ").append(privateKey); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletLogPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletLogPojo.java new file mode 100644 index 0000000..4cbf9de --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletLogPojo.java @@ -0,0 +1,229 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 资产流水 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletLogPojo implements Serializable { + + private static final long serialVersionUID = -1751726900; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer memberId; + private Integer walletId; + private Integer type; + private Integer coinId; + private Integer opType; + private String opRemark; + private BigDecimal opValue; + private BigDecimal opBefore; + private BigDecimal opAfter; + private String extRemark; + + public TMemberWalletLogPojo() {} + + public TMemberWalletLogPojo(TMemberWalletLogPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.memberId = value.memberId; + this.walletId = value.walletId; + this.type = value.type; + this.coinId = value.coinId; + this.opType = value.opType; + this.opRemark = value.opRemark; + this.opValue = value.opValue; + this.opBefore = value.opBefore; + this.opAfter = value.opAfter; + this.extRemark = value.extRemark; + } + + public TMemberWalletLogPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer memberId, + Integer walletId, + Integer type, + Integer coinId, + Integer opType, + String opRemark, + BigDecimal opValue, + BigDecimal opBefore, + BigDecimal opAfter, + String extRemark + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.memberId = memberId; + this.walletId = walletId; + this.type = type; + this.coinId = coinId; + this.opType = opType; + this.opRemark = opRemark; + this.opValue = opValue; + this.opBefore = opBefore; + this.opAfter = opAfter; + this.extRemark = extRemark; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getMemberId() { + return this.memberId; + } + + public void setMemberId(Integer memberId) { + this.memberId = memberId; + } + + public Integer getWalletId() { + return this.walletId; + } + + public void setWalletId(Integer walletId) { + this.walletId = walletId; + } + + public Integer getType() { + return this.type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getCoinId() { + return this.coinId; + } + + public void setCoinId(Integer coinId) { + this.coinId = coinId; + } + + public Integer getOpType() { + return this.opType; + } + + public void setOpType(Integer opType) { + this.opType = opType; + } + + public String getOpRemark() { + return this.opRemark; + } + + public void setOpRemark(String opRemark) { + this.opRemark = opRemark; + } + + public BigDecimal getOpValue() { + return this.opValue; + } + + public void setOpValue(BigDecimal opValue) { + this.opValue = opValue; + } + + public BigDecimal getOpBefore() { + return this.opBefore; + } + + public void setOpBefore(BigDecimal opBefore) { + this.opBefore = opBefore; + } + + public BigDecimal getOpAfter() { + return this.opAfter; + } + + public void setOpAfter(BigDecimal opAfter) { + this.opAfter = opAfter; + } + + public String getExtRemark() { + return this.extRemark; + } + + public void setExtRemark(String extRemark) { + this.extRemark = extRemark; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TMemberWalletLogPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(memberId); + sb.append(", ").append(walletId); + sb.append(", ").append(type); + sb.append(", ").append(coinId); + sb.append(", ").append(opType); + sb.append(", ").append(opRemark); + sb.append(", ").append(opValue); + sb.append(", ").append(opBefore); + sb.append(", ").append(opAfter); + sb.append(", ").append(extRemark); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletPojo.java new file mode 100644 index 0000000..c500874 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TMemberWalletPojo.java @@ -0,0 +1,151 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 资产 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletPojo implements Serializable { + + private static final long serialVersionUID = -460930499; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private Integer memberId; + private Integer coinId; + private BigDecimal balance; + private BigDecimal frozen; + + public TMemberWalletPojo() {} + + public TMemberWalletPojo(TMemberWalletPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.memberId = value.memberId; + this.coinId = value.coinId; + this.balance = value.balance; + this.frozen = value.frozen; + } + + public TMemberWalletPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + Integer memberId, + Integer coinId, + BigDecimal balance, + BigDecimal frozen + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.memberId = memberId; + this.coinId = coinId; + this.balance = balance; + this.frozen = frozen; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public Integer getMemberId() { + return this.memberId; + } + + public void setMemberId(Integer memberId) { + this.memberId = memberId; + } + + public Integer getCoinId() { + return this.coinId; + } + + public void setCoinId(Integer coinId) { + this.coinId = coinId; + } + + public BigDecimal getBalance() { + return this.balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + + public BigDecimal getFrozen() { + return this.frozen; + } + + public void setFrozen(BigDecimal frozen) { + this.frozen = frozen; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TMemberWalletPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(memberId); + sb.append(", ").append(coinId); + sb.append(", ").append(balance); + sb.append(", ").append(frozen); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniBannerPojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniBannerPojo.java new file mode 100644 index 0000000..29dce12 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniBannerPojo.java @@ -0,0 +1,163 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * Banner + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniBannerPojo implements Serializable { + + private static final long serialVersionUID = -315217801; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String lang; + private String title; + private String imageUrl; + private Integer state; + private String targetUrl; + + public TUniBannerPojo() {} + + public TUniBannerPojo(TUniBannerPojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.lang = value.lang; + this.title = value.title; + this.imageUrl = value.imageUrl; + this.state = value.state; + this.targetUrl = value.targetUrl; + } + + public TUniBannerPojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String lang, + String title, + String imageUrl, + Integer state, + String targetUrl + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.lang = lang; + this.title = title; + this.imageUrl = imageUrl; + this.state = state; + this.targetUrl = targetUrl; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getLang() { + return this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getImageUrl() { + return this.imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public Integer getState() { + return this.state; + } + + public void setState(Integer state) { + this.state = state; + } + + public String getTargetUrl() { + return this.targetUrl; + } + + public void setTargetUrl(String targetUrl) { + this.targetUrl = targetUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TUniBannerPojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(lang); + sb.append(", ").append(title); + sb.append(", ").append(imageUrl); + sb.append(", ").append(state); + sb.append(", ").append(targetUrl); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniNoticePojo.java b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniNoticePojo.java new file mode 100644 index 0000000..9ecfe60 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/pojos/TUniNoticePojo.java @@ -0,0 +1,163 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.pojos; + + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.annotation.Generated; + + +/** + * 公告 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniNoticePojo implements Serializable { + + private static final long serialVersionUID = 1390462942; + + private Integer id; + private Timestamp createTime; + private Timestamp updateTime; + private Byte flag; + private String title; + private String content; + private Timestamp publishTime; + private Integer state; + private String lang; + + public TUniNoticePojo() {} + + public TUniNoticePojo(TUniNoticePojo value) { + this.id = value.id; + this.createTime = value.createTime; + this.updateTime = value.updateTime; + this.flag = value.flag; + this.title = value.title; + this.content = value.content; + this.publishTime = value.publishTime; + this.state = value.state; + this.lang = value.lang; + } + + public TUniNoticePojo( + Integer id, + Timestamp createTime, + Timestamp updateTime, + Byte flag, + String title, + String content, + Timestamp publishTime, + Integer state, + String lang + ) { + this.id = id; + this.createTime = createTime; + this.updateTime = updateTime; + this.flag = flag; + this.title = title; + this.content = content; + this.publishTime = publishTime; + this.state = state; + this.lang = lang; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Timestamp getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Timestamp createTime) { + this.createTime = createTime; + } + + public Timestamp getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Timestamp updateTime) { + this.updateTime = updateTime; + } + + public Byte getFlag() { + return this.flag; + } + + public void setFlag(Byte flag) { + this.flag = flag; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return this.content; + } + + public void setContent(String content) { + this.content = content; + } + + public Timestamp getPublishTime() { + return this.publishTime; + } + + public void setPublishTime(Timestamp publishTime) { + this.publishTime = publishTime; + } + + public Integer getState() { + return this.state; + } + + public void setState(Integer state) { + this.state = state; + } + + public String getLang() { + return this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TUniNoticePojo ("); + + sb.append(id); + sb.append(", ").append(createTime); + sb.append(", ").append(updateTime); + sb.append(", ").append(flag); + sb.append(", ").append(title); + sb.append(", ").append(content); + sb.append(", ").append(publishTime); + sb.append(", ").append(state); + sb.append(", ").append(lang); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityConfigRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityConfigRecord.java new file mode 100644 index 0000000..0b2ccbf --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityConfigRecord.java @@ -0,0 +1,637 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.ActivityConfigTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record15; +import org.jooq.Row15; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 活动配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityConfigRecord extends UpdatableRecordImpl implements Record15 { + + private static final long serialVersionUID = -134209651; + + /** + * Setter for activity_config.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for activity_config.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for activity_config.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for activity_config.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for activity_config.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for activity_config.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for activity_config.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for activity_config.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for activity_config.title. 活动标题 + */ + public void setTitle(String value) { + set(4, value); + } + + /** + * Getter for activity_config.title. 活动标题 + */ + public String getTitle() { + return (String) get(4); + } + + /** + * Setter for activity_config.title_content. 活动内容 + */ + public void setTitleContent(String value) { + set(5, value); + } + + /** + * Getter for activity_config.title_content. 活动内容 + */ + public String getTitleContent() { + return (String) get(5); + } + + /** + * Setter for activity_config.activity_img. 活动图片 + */ + public void setActivityImg(String value) { + set(6, value); + } + + /** + * Getter for activity_config.activity_img. 活动图片 + */ + public String getActivityImg() { + return (String) get(6); + } + + /** + * Setter for activity_config.activity_url. 活动跳转链接 + */ + public void setActivityUrl(String value) { + set(7, value); + } + + /** + * Getter for activity_config.activity_url. 活动跳转链接 + */ + public String getActivityUrl() { + return (String) get(7); + } + + /** + * Setter for activity_config.state. 1=进行中 2=已结束 3=已下架 + */ + public void setState(Integer value) { + set(8, value); + } + + /** + * Getter for activity_config.state. 1=进行中 2=已结束 3=已下架 + */ + public Integer getState() { + return (Integer) get(8); + } + + /** + * Setter for activity_config.amount. 奖励金额 + */ + public void setAmount(BigDecimal value) { + set(9, value); + } + + /** + * Getter for activity_config.amount. 奖励金额 + */ + public BigDecimal getAmount() { + return (BigDecimal) get(9); + } + + /** + * Setter for activity_config.superior_amount. 上级奖励金额 + */ + public void setSuperiorAmount(BigDecimal value) { + set(10, value); + } + + /** + * Getter for activity_config.superior_amount. 上级奖励金额 + */ + public BigDecimal getSuperiorAmount() { + return (BigDecimal) get(10); + } + + /** + * Setter for activity_config.activity_number. 每天可以做的次数(每天1次) -1表示任务是一次性的 + */ + public void setActivityNumber(Integer value) { + set(11, value); + } + + /** + * Getter for activity_config.activity_number. 每天可以做的次数(每天1次) -1表示任务是一次性的 + */ + public Integer getActivityNumber() { + return (Integer) get(11); + } + + /** + * Setter for activity_config.category. 1=社交媒体活动 2=测试网络活动 + */ + public void setCategory(Integer value) { + set(12, value); + } + + /** + * Getter for activity_config.category. 1=社交媒体活动 2=测试网络活动 + */ + public Integer getCategory() { + return (Integer) get(12); + } + + /** + * Setter for activity_config.type. 1=推特关注 2=推特转载 3=推特点赞 4=推特评论 5=推特改名 6=加入Discord 7=推荐 8=测试跨链桥 9=绑定邀请码 10=加入TG + */ + public void setType(Integer value) { + set(13, value); + } + + /** + * Getter for activity_config.type. 1=推特关注 2=推特转载 3=推特点赞 4=推特评论 5=推特改名 6=加入Discord 7=推荐 8=测试跨链桥 9=绑定邀请码 10=加入TG + */ + public Integer getType() { + return (Integer) get(13); + } + + /** + * Setter for activity_config.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public void setMark(String value) { + set(14, value); + } + + /** + * Getter for activity_config.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public String getMark() { + return (String) get(14); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record15 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row15 fieldsRow() { + return (Row15) super.fieldsRow(); + } + + @Override + public Row15 valuesRow() { + return (Row15) super.valuesRow(); + } + + @Override + public Field field1() { + return ActivityConfigTable.ACTIVITY_CONFIG.ID; + } + + @Override + public Field field2() { + return ActivityConfigTable.ACTIVITY_CONFIG.CREATE_TIME; + } + + @Override + public Field field3() { + return ActivityConfigTable.ACTIVITY_CONFIG.UPDATE_TIME; + } + + @Override + public Field field4() { + return ActivityConfigTable.ACTIVITY_CONFIG.FLAG; + } + + @Override + public Field field5() { + return ActivityConfigTable.ACTIVITY_CONFIG.TITLE; + } + + @Override + public Field field6() { + return ActivityConfigTable.ACTIVITY_CONFIG.TITLE_CONTENT; + } + + @Override + public Field field7() { + return ActivityConfigTable.ACTIVITY_CONFIG.ACTIVITY_IMG; + } + + @Override + public Field field8() { + return ActivityConfigTable.ACTIVITY_CONFIG.ACTIVITY_URL; + } + + @Override + public Field field9() { + return ActivityConfigTable.ACTIVITY_CONFIG.STATE; + } + + @Override + public Field field10() { + return ActivityConfigTable.ACTIVITY_CONFIG.AMOUNT; + } + + @Override + public Field field11() { + return ActivityConfigTable.ACTIVITY_CONFIG.SUPERIOR_AMOUNT; + } + + @Override + public Field field12() { + return ActivityConfigTable.ACTIVITY_CONFIG.ACTIVITY_NUMBER; + } + + @Override + public Field field13() { + return ActivityConfigTable.ACTIVITY_CONFIG.CATEGORY; + } + + @Override + public Field field14() { + return ActivityConfigTable.ACTIVITY_CONFIG.TYPE; + } + + @Override + public Field field15() { + return ActivityConfigTable.ACTIVITY_CONFIG.MARK; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getTitle(); + } + + @Override + public String component6() { + return getTitleContent(); + } + + @Override + public String component7() { + return getActivityImg(); + } + + @Override + public String component8() { + return getActivityUrl(); + } + + @Override + public Integer component9() { + return getState(); + } + + @Override + public BigDecimal component10() { + return getAmount(); + } + + @Override + public BigDecimal component11() { + return getSuperiorAmount(); + } + + @Override + public Integer component12() { + return getActivityNumber(); + } + + @Override + public Integer component13() { + return getCategory(); + } + + @Override + public Integer component14() { + return getType(); + } + + @Override + public String component15() { + return getMark(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getTitle(); + } + + @Override + public String value6() { + return getTitleContent(); + } + + @Override + public String value7() { + return getActivityImg(); + } + + @Override + public String value8() { + return getActivityUrl(); + } + + @Override + public Integer value9() { + return getState(); + } + + @Override + public BigDecimal value10() { + return getAmount(); + } + + @Override + public BigDecimal value11() { + return getSuperiorAmount(); + } + + @Override + public Integer value12() { + return getActivityNumber(); + } + + @Override + public Integer value13() { + return getCategory(); + } + + @Override + public Integer value14() { + return getType(); + } + + @Override + public String value15() { + return getMark(); + } + + @Override + public ActivityConfigRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public ActivityConfigRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public ActivityConfigRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public ActivityConfigRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public ActivityConfigRecord value5(String value) { + setTitle(value); + return this; + } + + @Override + public ActivityConfigRecord value6(String value) { + setTitleContent(value); + return this; + } + + @Override + public ActivityConfigRecord value7(String value) { + setActivityImg(value); + return this; + } + + @Override + public ActivityConfigRecord value8(String value) { + setActivityUrl(value); + return this; + } + + @Override + public ActivityConfigRecord value9(Integer value) { + setState(value); + return this; + } + + @Override + public ActivityConfigRecord value10(BigDecimal value) { + setAmount(value); + return this; + } + + @Override + public ActivityConfigRecord value11(BigDecimal value) { + setSuperiorAmount(value); + return this; + } + + @Override + public ActivityConfigRecord value12(Integer value) { + setActivityNumber(value); + return this; + } + + @Override + public ActivityConfigRecord value13(Integer value) { + setCategory(value); + return this; + } + + @Override + public ActivityConfigRecord value14(Integer value) { + setType(value); + return this; + } + + @Override + public ActivityConfigRecord value15(String value) { + setMark(value); + return this; + } + + @Override + public ActivityConfigRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, String value7, String value8, Integer value9, BigDecimal value10, BigDecimal value11, Integer value12, Integer value13, Integer value14, String value15) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + value15(value15); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ActivityConfigRecord + */ + public ActivityConfigRecord() { + super(ActivityConfigTable.ACTIVITY_CONFIG); + } + + /** + * Create a detached, initialised ActivityConfigRecord + */ + public ActivityConfigRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String title, String titleContent, String activityImg, String activityUrl, Integer state, BigDecimal amount, BigDecimal superiorAmount, Integer activityNumber, Integer category, Integer type, String mark) { + super(ActivityConfigTable.ACTIVITY_CONFIG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, title); + set(5, titleContent); + set(6, activityImg); + set(7, activityUrl); + set(8, state); + set(9, amount); + set(10, superiorAmount); + set(11, activityNumber); + set(12, category); + set(13, type); + set(14, mark); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityLogRecord.java new file mode 100644 index 0000000..eb93774 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityLogRecord.java @@ -0,0 +1,674 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.ActivityLogTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record16; +import org.jooq.Row16; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 活动任务日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityLogRecord extends UpdatableRecordImpl implements Record16 { + + private static final long serialVersionUID = -1166835423; + + /** + * Setter for activity_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for activity_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for activity_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for activity_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for activity_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for activity_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for activity_log.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for activity_log.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for activity_log.activity_config_id. 配置ID + */ + public void setActivityConfigId(Integer value) { + set(4, value); + } + + /** + * Getter for activity_log.activity_config_id. 配置ID + */ + public Integer getActivityConfigId() { + return (Integer) get(4); + } + + /** + * Setter for activity_log.address. 用户地址 + */ + public void setAddress(String value) { + set(5, value); + } + + /** + * Getter for activity_log.address. 用户地址 + */ + public String getAddress() { + return (String) get(5); + } + + /** + * Setter for activity_log.superior_address. 上级地址 + */ + public void setSuperiorAddress(String value) { + set(6, value); + } + + /** + * Getter for activity_log.superior_address. 上级地址 + */ + public String getSuperiorAddress() { + return (String) get(6); + } + + /** + * Setter for activity_log.title. 活动标题 + */ + public void setTitle(String value) { + set(7, value); + } + + /** + * Getter for activity_log.title. 活动标题 + */ + public String getTitle() { + return (String) get(7); + } + + /** + * Setter for activity_log.type. 1=发起任务 2=已完成 3=失败 + */ + public void setType(Integer value) { + set(8, value); + } + + /** + * Getter for activity_log.type. 1=发起任务 2=已完成 3=失败 + */ + public Integer getType() { + return (Integer) get(8); + } + + /** + * Setter for activity_log.amount. 奖励金额 + */ + public void setAmount(BigDecimal value) { + set(9, value); + } + + /** + * Getter for activity_log.amount. 奖励金额 + */ + public BigDecimal getAmount() { + return (BigDecimal) get(9); + } + + /** + * Setter for activity_log.superior_amount. 上级奖励金额 + */ + public void setSuperiorAmount(BigDecimal value) { + set(10, value); + } + + /** + * Getter for activity_log.superior_amount. 上级奖励金额 + */ + public BigDecimal getSuperiorAmount() { + return (BigDecimal) get(10); + } + + /** + * Setter for activity_log.end_time. 任务结束时间 + */ + public void setEndTime(Timestamp value) { + set(11, value); + } + + /** + * Getter for activity_log.end_time. 任务结束时间 + */ + public Timestamp getEndTime() { + return (Timestamp) get(11); + } + + /** + * Setter for activity_log.config_type. 配置的TYPE + */ + public void setConfigType(Integer value) { + set(12, value); + } + + /** + * Getter for activity_log.config_type. 配置的TYPE + */ + public Integer getConfigType() { + return (Integer) get(12); + } + + /** + * Setter for activity_log.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public void setMark(String value) { + set(13, value); + } + + /** + * Getter for activity_log.mark. (关注的推特名)(评论、转载、点赞的推文ID、改名的后缀) + */ + public String getMark() { + return (String) get(13); + } + + /** + * Setter for activity_log.hashs. 转账hash,多笔中间用逗号分隔 + */ + public void setHashs(String value) { + set(14, value); + } + + /** + * Getter for activity_log.hashs. 转账hash,多笔中间用逗号分隔 + */ + public String getHashs() { + return (String) get(14); + } + + /** + * Setter for activity_log.transfer_type. 0:未执行链上发放 1:已链上发放 + */ + public void setTransferType(Integer value) { + set(15, value); + } + + /** + * Getter for activity_log.transfer_type. 0:未执行链上发放 1:已链上发放 + */ + public Integer getTransferType() { + return (Integer) get(15); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record16 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } + + @Override + public Row16 valuesRow() { + return (Row16) super.valuesRow(); + } + + @Override + public Field field1() { + return ActivityLogTable.ACTIVITY_LOG.ID; + } + + @Override + public Field field2() { + return ActivityLogTable.ACTIVITY_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return ActivityLogTable.ACTIVITY_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return ActivityLogTable.ACTIVITY_LOG.FLAG; + } + + @Override + public Field field5() { + return ActivityLogTable.ACTIVITY_LOG.ACTIVITY_CONFIG_ID; + } + + @Override + public Field field6() { + return ActivityLogTable.ACTIVITY_LOG.ADDRESS; + } + + @Override + public Field field7() { + return ActivityLogTable.ACTIVITY_LOG.SUPERIOR_ADDRESS; + } + + @Override + public Field field8() { + return ActivityLogTable.ACTIVITY_LOG.TITLE; + } + + @Override + public Field field9() { + return ActivityLogTable.ACTIVITY_LOG.TYPE; + } + + @Override + public Field field10() { + return ActivityLogTable.ACTIVITY_LOG.AMOUNT; + } + + @Override + public Field field11() { + return ActivityLogTable.ACTIVITY_LOG.SUPERIOR_AMOUNT; + } + + @Override + public Field field12() { + return ActivityLogTable.ACTIVITY_LOG.END_TIME; + } + + @Override + public Field field13() { + return ActivityLogTable.ACTIVITY_LOG.CONFIG_TYPE; + } + + @Override + public Field field14() { + return ActivityLogTable.ACTIVITY_LOG.MARK; + } + + @Override + public Field field15() { + return ActivityLogTable.ACTIVITY_LOG.HASHS; + } + + @Override + public Field field16() { + return ActivityLogTable.ACTIVITY_LOG.TRANSFER_TYPE; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getActivityConfigId(); + } + + @Override + public String component6() { + return getAddress(); + } + + @Override + public String component7() { + return getSuperiorAddress(); + } + + @Override + public String component8() { + return getTitle(); + } + + @Override + public Integer component9() { + return getType(); + } + + @Override + public BigDecimal component10() { + return getAmount(); + } + + @Override + public BigDecimal component11() { + return getSuperiorAmount(); + } + + @Override + public Timestamp component12() { + return getEndTime(); + } + + @Override + public Integer component13() { + return getConfigType(); + } + + @Override + public String component14() { + return getMark(); + } + + @Override + public String component15() { + return getHashs(); + } + + @Override + public Integer component16() { + return getTransferType(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getActivityConfigId(); + } + + @Override + public String value6() { + return getAddress(); + } + + @Override + public String value7() { + return getSuperiorAddress(); + } + + @Override + public String value8() { + return getTitle(); + } + + @Override + public Integer value9() { + return getType(); + } + + @Override + public BigDecimal value10() { + return getAmount(); + } + + @Override + public BigDecimal value11() { + return getSuperiorAmount(); + } + + @Override + public Timestamp value12() { + return getEndTime(); + } + + @Override + public Integer value13() { + return getConfigType(); + } + + @Override + public String value14() { + return getMark(); + } + + @Override + public String value15() { + return getHashs(); + } + + @Override + public Integer value16() { + return getTransferType(); + } + + @Override + public ActivityLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public ActivityLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public ActivityLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public ActivityLogRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public ActivityLogRecord value5(Integer value) { + setActivityConfigId(value); + return this; + } + + @Override + public ActivityLogRecord value6(String value) { + setAddress(value); + return this; + } + + @Override + public ActivityLogRecord value7(String value) { + setSuperiorAddress(value); + return this; + } + + @Override + public ActivityLogRecord value8(String value) { + setTitle(value); + return this; + } + + @Override + public ActivityLogRecord value9(Integer value) { + setType(value); + return this; + } + + @Override + public ActivityLogRecord value10(BigDecimal value) { + setAmount(value); + return this; + } + + @Override + public ActivityLogRecord value11(BigDecimal value) { + setSuperiorAmount(value); + return this; + } + + @Override + public ActivityLogRecord value12(Timestamp value) { + setEndTime(value); + return this; + } + + @Override + public ActivityLogRecord value13(Integer value) { + setConfigType(value); + return this; + } + + @Override + public ActivityLogRecord value14(String value) { + setMark(value); + return this; + } + + @Override + public ActivityLogRecord value15(String value) { + setHashs(value); + return this; + } + + @Override + public ActivityLogRecord value16(Integer value) { + setTransferType(value); + return this; + } + + @Override + public ActivityLogRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, String value6, String value7, String value8, Integer value9, BigDecimal value10, BigDecimal value11, Timestamp value12, Integer value13, String value14, String value15, Integer value16) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + value15(value15); + value16(value16); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ActivityLogRecord + */ + public ActivityLogRecord() { + super(ActivityLogTable.ACTIVITY_LOG); + } + + /** + * Create a detached, initialised ActivityLogRecord + */ + public ActivityLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer activityConfigId, String address, String superiorAddress, String title, Integer type, BigDecimal amount, BigDecimal superiorAmount, Timestamp endTime, Integer configType, String mark, String hashs, Integer transferType) { + super(ActivityLogTable.ACTIVITY_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, activityConfigId); + set(5, address); + set(6, superiorAddress); + set(7, title); + set(8, type); + set(9, amount); + set(10, superiorAmount); + set(11, endTime); + set(12, configType); + set(13, mark); + set(14, hashs); + set(15, transferType); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityStatisticsRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityStatisticsRecord.java new file mode 100644 index 0000000..96b2726 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ActivityStatisticsRecord.java @@ -0,0 +1,304 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.ActivityStatisticsTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record6; +import org.jooq.Row6; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 业绩统计 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityStatisticsRecord extends UpdatableRecordImpl implements Record6 { + + private static final long serialVersionUID = 973204497; + + /** + * Setter for activity_statistics.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for activity_statistics.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for activity_statistics.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for activity_statistics.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for activity_statistics.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for activity_statistics.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for activity_statistics.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for activity_statistics.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for activity_statistics.address. 用户地址 + */ + public void setAddress(String value) { + set(4, value); + } + + /** + * Getter for activity_statistics.address. 用户地址 + */ + public String getAddress() { + return (String) get(4); + } + + /** + * Setter for activity_statistics.amount. 累计业绩 + */ + public void setAmount(BigDecimal value) { + set(5, value); + } + + /** + * Getter for activity_statistics.amount. 累计业绩 + */ + public BigDecimal getAmount() { + return (BigDecimal) get(5); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record6 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row6 fieldsRow() { + return (Row6) super.fieldsRow(); + } + + @Override + public Row6 valuesRow() { + return (Row6) super.valuesRow(); + } + + @Override + public Field field1() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.ID; + } + + @Override + public Field field2() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.CREATE_TIME; + } + + @Override + public Field field3() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.UPDATE_TIME; + } + + @Override + public Field field4() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.FLAG; + } + + @Override + public Field field5() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.ADDRESS; + } + + @Override + public Field field6() { + return ActivityStatisticsTable.ACTIVITY_STATISTICS.AMOUNT; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getAddress(); + } + + @Override + public BigDecimal component6() { + return getAmount(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getAddress(); + } + + @Override + public BigDecimal value6() { + return getAmount(); + } + + @Override + public ActivityStatisticsRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public ActivityStatisticsRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public ActivityStatisticsRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public ActivityStatisticsRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public ActivityStatisticsRecord value5(String value) { + setAddress(value); + return this; + } + + @Override + public ActivityStatisticsRecord value6(BigDecimal value) { + setAmount(value); + return this; + } + + @Override + public ActivityStatisticsRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, BigDecimal value6) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ActivityStatisticsRecord + */ + public ActivityStatisticsRecord() { + super(ActivityStatisticsTable.ACTIVITY_STATISTICS); + } + + /** + * Create a detached, initialised ActivityStatisticsRecord + */ + public ActivityStatisticsRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String address, BigDecimal amount) { + super(ActivityStatisticsTable.ACTIVITY_STATISTICS); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, address); + set(5, amount); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/ChainLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ChainLogRecord.java new file mode 100644 index 0000000..8e292ef --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/ChainLogRecord.java @@ -0,0 +1,414 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.ChainLogTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record9; +import org.jooq.Row9; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 链日志同步 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ChainLogRecord extends UpdatableRecordImpl implements Record9 { + + private static final long serialVersionUID = 784563213; + + /** + * Setter for chain_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for chain_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for chain_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for chain_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for chain_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for chain_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for chain_log.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for chain_log.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for chain_log.block_number. 区块号 + */ + public void setBlockNumber(String value) { + set(4, value); + } + + /** + * Getter for chain_log.block_number. 区块号 + */ + public String getBlockNumber() { + return (String) get(4); + } + + /** + * Setter for chain_log.hash. 区块Hash + */ + public void setHash(String value) { + set(5, value); + } + + /** + * Getter for chain_log.hash. 区块Hash + */ + public String getHash() { + return (String) get(5); + } + + /** + * Setter for chain_log.chain_name. 事件名称 + */ + public void setChainName(String value) { + set(6, value); + } + + /** + * Getter for chain_log.chain_name. 事件名称 + */ + public String getChainName() { + return (String) get(6); + } + + /** + * Setter for chain_log.data_value. 事件内容 + */ + public void setDataValue(String value) { + set(7, value); + } + + /** + * Getter for chain_log.data_value. 事件内容 + */ + public String getDataValue() { + return (String) get(7); + } + + /** + * Setter for chain_log.transaction_hash. 交易hash + */ + public void setTransactionHash(String value) { + set(8, value); + } + + /** + * Getter for chain_log.transaction_hash. 交易hash + */ + public String getTransactionHash() { + return (String) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record9 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } + + @Override + public Row9 valuesRow() { + return (Row9) super.valuesRow(); + } + + @Override + public Field field1() { + return ChainLogTable.CHAIN_LOG.ID; + } + + @Override + public Field field2() { + return ChainLogTable.CHAIN_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return ChainLogTable.CHAIN_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return ChainLogTable.CHAIN_LOG.FLAG; + } + + @Override + public Field field5() { + return ChainLogTable.CHAIN_LOG.BLOCK_NUMBER; + } + + @Override + public Field field6() { + return ChainLogTable.CHAIN_LOG.HASH; + } + + @Override + public Field field7() { + return ChainLogTable.CHAIN_LOG.CHAIN_NAME; + } + + @Override + public Field field8() { + return ChainLogTable.CHAIN_LOG.DATA_VALUE; + } + + @Override + public Field field9() { + return ChainLogTable.CHAIN_LOG.TRANSACTION_HASH; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getBlockNumber(); + } + + @Override + public String component6() { + return getHash(); + } + + @Override + public String component7() { + return getChainName(); + } + + @Override + public String component8() { + return getDataValue(); + } + + @Override + public String component9() { + return getTransactionHash(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getBlockNumber(); + } + + @Override + public String value6() { + return getHash(); + } + + @Override + public String value7() { + return getChainName(); + } + + @Override + public String value8() { + return getDataValue(); + } + + @Override + public String value9() { + return getTransactionHash(); + } + + @Override + public ChainLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public ChainLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public ChainLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public ChainLogRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public ChainLogRecord value5(String value) { + setBlockNumber(value); + return this; + } + + @Override + public ChainLogRecord value6(String value) { + setHash(value); + return this; + } + + @Override + public ChainLogRecord value7(String value) { + setChainName(value); + return this; + } + + @Override + public ChainLogRecord value8(String value) { + setDataValue(value); + return this; + } + + @Override + public ChainLogRecord value9(String value) { + setTransactionHash(value); + return this; + } + + @Override + public ChainLogRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, String value7, String value8, String value9) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ChainLogRecord + */ + public ChainLogRecord() { + super(ChainLogTable.CHAIN_LOG); + } + + /** + * Create a detached, initialised ChainLogRecord + */ + public ChainLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String blockNumber, String hash, String chainName, String dataValue, String transactionHash) { + super(ChainLogTable.CHAIN_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, blockNumber); + set(5, hash); + set(6, chainName); + set(7, dataValue); + set(8, transactionHash); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/CoinConfigRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/CoinConfigRecord.java new file mode 100644 index 0000000..a0f4ab5 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/CoinConfigRecord.java @@ -0,0 +1,526 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.CoinConfigTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record12; +import org.jooq.Row12; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 币种配置表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class CoinConfigRecord extends UpdatableRecordImpl implements Record12 { + + private static final long serialVersionUID = -1040030680; + + /** + * Setter for coin_config.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for coin_config.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for coin_config.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for coin_config.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for coin_config.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for coin_config.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for coin_config.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for coin_config.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for coin_config.coin_name. 币种名称 + */ + public void setCoinName(String value) { + set(4, value); + } + + /** + * Getter for coin_config.coin_name. 币种名称 + */ + public String getCoinName() { + return (String) get(4); + } + + /** + * Setter for coin_config.state. 1=认购中 2=已下架 + */ + public void setState(Integer value) { + set(5, value); + } + + /** + * Getter for coin_config.state. 1=认购中 2=已下架 + */ + public Integer getState() { + return (Integer) get(5); + } + + /** + * Setter for coin_config.usdt_price. USDT 价格 + */ + public void setUsdtPrice(BigDecimal value) { + set(6, value); + } + + /** + * Getter for coin_config.usdt_price. USDT 价格 + */ + public BigDecimal getUsdtPrice() { + return (BigDecimal) get(6); + } + + /** + * Setter for coin_config.min_number. 最低认购数量 + */ + public void setMinNumber(BigDecimal value) { + set(7, value); + } + + /** + * Getter for coin_config.min_number. 最低认购数量 + */ + public BigDecimal getMinNumber() { + return (BigDecimal) get(7); + } + + /** + * Setter for coin_config.max_number. 最高认购数量 + */ + public void setMaxNumber(BigDecimal value) { + set(8, value); + } + + /** + * Getter for coin_config.max_number. 最高认购数量 + */ + public BigDecimal getMaxNumber() { + return (BigDecimal) get(8); + } + + /** + * Setter for coin_config.airdrop_number. 空投数量 + */ + public void setAirdropNumber(BigDecimal value) { + set(9, value); + } + + /** + * Getter for coin_config.airdrop_number. 空投数量 + */ + public BigDecimal getAirdropNumber() { + return (BigDecimal) get(9); + } + + /** + * Setter for coin_config.private_placement. 私募总金额 + */ + public void setPrivatePlacement(BigDecimal value) { + set(10, value); + } + + /** + * Getter for coin_config.private_placement. 私募总金额 + */ + public BigDecimal getPrivatePlacement() { + return (BigDecimal) get(10); + } + + /** + * Setter for coin_config.to_private_placement. 已消耗私募金额 + */ + public void setToPrivatePlacement(BigDecimal value) { + set(11, value); + } + + /** + * Getter for coin_config.to_private_placement. 已消耗私募金额 + */ + public BigDecimal getToPrivatePlacement() { + return (BigDecimal) get(11); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record12 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } + + @Override + public Row12 valuesRow() { + return (Row12) super.valuesRow(); + } + + @Override + public Field field1() { + return CoinConfigTable.COIN_CONFIG.ID; + } + + @Override + public Field field2() { + return CoinConfigTable.COIN_CONFIG.CREATE_TIME; + } + + @Override + public Field field3() { + return CoinConfigTable.COIN_CONFIG.UPDATE_TIME; + } + + @Override + public Field field4() { + return CoinConfigTable.COIN_CONFIG.FLAG; + } + + @Override + public Field field5() { + return CoinConfigTable.COIN_CONFIG.COIN_NAME; + } + + @Override + public Field field6() { + return CoinConfigTable.COIN_CONFIG.STATE; + } + + @Override + public Field field7() { + return CoinConfigTable.COIN_CONFIG.USDT_PRICE; + } + + @Override + public Field field8() { + return CoinConfigTable.COIN_CONFIG.MIN_NUMBER; + } + + @Override + public Field field9() { + return CoinConfigTable.COIN_CONFIG.MAX_NUMBER; + } + + @Override + public Field field10() { + return CoinConfigTable.COIN_CONFIG.AIRDROP_NUMBER; + } + + @Override + public Field field11() { + return CoinConfigTable.COIN_CONFIG.PRIVATE_PLACEMENT; + } + + @Override + public Field field12() { + return CoinConfigTable.COIN_CONFIG.TO_PRIVATE_PLACEMENT; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getCoinName(); + } + + @Override + public Integer component6() { + return getState(); + } + + @Override + public BigDecimal component7() { + return getUsdtPrice(); + } + + @Override + public BigDecimal component8() { + return getMinNumber(); + } + + @Override + public BigDecimal component9() { + return getMaxNumber(); + } + + @Override + public BigDecimal component10() { + return getAirdropNumber(); + } + + @Override + public BigDecimal component11() { + return getPrivatePlacement(); + } + + @Override + public BigDecimal component12() { + return getToPrivatePlacement(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getCoinName(); + } + + @Override + public Integer value6() { + return getState(); + } + + @Override + public BigDecimal value7() { + return getUsdtPrice(); + } + + @Override + public BigDecimal value8() { + return getMinNumber(); + } + + @Override + public BigDecimal value9() { + return getMaxNumber(); + } + + @Override + public BigDecimal value10() { + return getAirdropNumber(); + } + + @Override + public BigDecimal value11() { + return getPrivatePlacement(); + } + + @Override + public BigDecimal value12() { + return getToPrivatePlacement(); + } + + @Override + public CoinConfigRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public CoinConfigRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public CoinConfigRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public CoinConfigRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public CoinConfigRecord value5(String value) { + setCoinName(value); + return this; + } + + @Override + public CoinConfigRecord value6(Integer value) { + setState(value); + return this; + } + + @Override + public CoinConfigRecord value7(BigDecimal value) { + setUsdtPrice(value); + return this; + } + + @Override + public CoinConfigRecord value8(BigDecimal value) { + setMinNumber(value); + return this; + } + + @Override + public CoinConfigRecord value9(BigDecimal value) { + setMaxNumber(value); + return this; + } + + @Override + public CoinConfigRecord value10(BigDecimal value) { + setAirdropNumber(value); + return this; + } + + @Override + public CoinConfigRecord value11(BigDecimal value) { + setPrivatePlacement(value); + return this; + } + + @Override + public CoinConfigRecord value12(BigDecimal value) { + setToPrivatePlacement(value); + return this; + } + + @Override + public CoinConfigRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, Integer value6, BigDecimal value7, BigDecimal value8, BigDecimal value9, BigDecimal value10, BigDecimal value11, BigDecimal value12) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached CoinConfigRecord + */ + public CoinConfigRecord() { + super(CoinConfigTable.COIN_CONFIG); + } + + /** + * Create a detached, initialised CoinConfigRecord + */ + public CoinConfigRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String coinName, Integer state, BigDecimal usdtPrice, BigDecimal minNumber, BigDecimal maxNumber, BigDecimal airdropNumber, BigDecimal privatePlacement, BigDecimal toPrivatePlacement) { + super(CoinConfigTable.COIN_CONFIG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, coinName); + set(5, state); + set(6, usdtPrice); + set(7, minNumber); + set(8, maxNumber); + set(9, airdropNumber); + set(10, privatePlacement); + set(11, toPrivatePlacement); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeAwardSettingRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeAwardSettingRecord.java new file mode 100644 index 0000000..829c081 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeAwardSettingRecord.java @@ -0,0 +1,563 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeAwardSettingTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record13; +import org.jooq.Row13; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 节点奖励设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeAwardSettingRecord extends UpdatableRecordImpl implements Record13 { + + private static final long serialVersionUID = -1672213397; + + /** + * Setter for node_award_setting.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node_award_setting.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node_award_setting.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node_award_setting.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node_award_setting.create_by. 创建人 + */ + public void setCreateBy(String value) { + set(2, value); + } + + /** + * Getter for node_award_setting.create_by. 创建人 + */ + public String getCreateBy() { + return (String) get(2); + } + + /** + * Setter for node_award_setting.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(3, value); + } + + /** + * Getter for node_award_setting.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(3); + } + + /** + * Setter for node_award_setting.update_by. 更新人 + */ + public void setUpdateBy(String value) { + set(4, value); + } + + /** + * Getter for node_award_setting.update_by. 更新人 + */ + public String getUpdateBy() { + return (String) get(4); + } + + /** + * Setter for node_award_setting.node_setting_id. 节点奖励id + */ + public void setNodeSettingId(Integer value) { + set(5, value); + } + + /** + * Getter for node_award_setting.node_setting_id. 节点奖励id + */ + public Integer getNodeSettingId() { + return (Integer) get(5); + } + + /** + * Setter for node_award_setting.rebate. 返佣比例 + */ + public void setRebate(BigDecimal value) { + set(6, value); + } + + /** + * Getter for node_award_setting.rebate. 返佣比例 + */ + public BigDecimal getRebate() { + return (BigDecimal) get(6); + } + + /** + * Setter for node_award_setting.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public void setRbitAmount(BigDecimal value) { + set(7, value); + } + + /** + * Getter for node_award_setting.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public BigDecimal getRbitAmount() { + return (BigDecimal) get(7); + } + + /** + * Setter for node_award_setting.rbit_one. 1代Rbit奖励比例 + */ + public void setRbitOne(BigDecimal value) { + set(8, value); + } + + /** + * Getter for node_award_setting.rbit_one. 1代Rbit奖励比例 + */ + public BigDecimal getRbitOne() { + return (BigDecimal) get(8); + } + + /** + * Setter for node_award_setting.rebate_two. 2代Rbit奖励比例 + */ + public void setRebateTwo(BigDecimal value) { + set(9, value); + } + + /** + * Getter for node_award_setting.rebate_two. 2代Rbit奖励比例 + */ + public BigDecimal getRebateTwo() { + return (BigDecimal) get(9); + } + + /** + * Setter for node_award_setting.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public void setNftAmount(BigDecimal value) { + set(10, value); + } + + /** + * Getter for node_award_setting.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public BigDecimal getNftAmount() { + return (BigDecimal) get(10); + } + + /** + * Setter for node_award_setting.nft_one. 1代NFT碎片奖励比例 + */ + public void setNftOne(BigDecimal value) { + set(11, value); + } + + /** + * Getter for node_award_setting.nft_one. 1代NFT碎片奖励比例 + */ + public BigDecimal getNftOne() { + return (BigDecimal) get(11); + } + + /** + * Setter for node_award_setting.nft_two. 2代NFT碎片奖励比例 + */ + public void setNftTwo(BigDecimal value) { + set(12, value); + } + + /** + * Getter for node_award_setting.nft_two. 2代NFT碎片奖励比例 + */ + public BigDecimal getNftTwo() { + return (BigDecimal) get(12); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record13 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row13 fieldsRow() { + return (Row13) super.fieldsRow(); + } + + @Override + public Row13 valuesRow() { + return (Row13) super.valuesRow(); + } + + @Override + public Field field1() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.ID; + } + + @Override + public Field field2() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.CREATE_TIME; + } + + @Override + public Field field3() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.CREATE_BY; + } + + @Override + public Field field4() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.UPDATE_TIME; + } + + @Override + public Field field5() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.UPDATE_BY; + } + + @Override + public Field field6() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.NODE_SETTING_ID; + } + + @Override + public Field field7() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.REBATE; + } + + @Override + public Field field8() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.RBIT_AMOUNT; + } + + @Override + public Field field9() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.RBIT_ONE; + } + + @Override + public Field field10() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.REBATE_TWO; + } + + @Override + public Field field11() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.NFT_AMOUNT; + } + + @Override + public Field field12() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.NFT_ONE; + } + + @Override + public Field field13() { + return NodeAwardSettingTable.NODE_AWARD_SETTING.NFT_TWO; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public String component3() { + return getCreateBy(); + } + + @Override + public Timestamp component4() { + return getUpdateTime(); + } + + @Override + public String component5() { + return getUpdateBy(); + } + + @Override + public Integer component6() { + return getNodeSettingId(); + } + + @Override + public BigDecimal component7() { + return getRebate(); + } + + @Override + public BigDecimal component8() { + return getRbitAmount(); + } + + @Override + public BigDecimal component9() { + return getRbitOne(); + } + + @Override + public BigDecimal component10() { + return getRebateTwo(); + } + + @Override + public BigDecimal component11() { + return getNftAmount(); + } + + @Override + public BigDecimal component12() { + return getNftOne(); + } + + @Override + public BigDecimal component13() { + return getNftTwo(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public String value3() { + return getCreateBy(); + } + + @Override + public Timestamp value4() { + return getUpdateTime(); + } + + @Override + public String value5() { + return getUpdateBy(); + } + + @Override + public Integer value6() { + return getNodeSettingId(); + } + + @Override + public BigDecimal value7() { + return getRebate(); + } + + @Override + public BigDecimal value8() { + return getRbitAmount(); + } + + @Override + public BigDecimal value9() { + return getRbitOne(); + } + + @Override + public BigDecimal value10() { + return getRebateTwo(); + } + + @Override + public BigDecimal value11() { + return getNftAmount(); + } + + @Override + public BigDecimal value12() { + return getNftOne(); + } + + @Override + public BigDecimal value13() { + return getNftTwo(); + } + + @Override + public NodeAwardSettingRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public NodeAwardSettingRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public NodeAwardSettingRecord value3(String value) { + setCreateBy(value); + return this; + } + + @Override + public NodeAwardSettingRecord value4(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public NodeAwardSettingRecord value5(String value) { + setUpdateBy(value); + return this; + } + + @Override + public NodeAwardSettingRecord value6(Integer value) { + setNodeSettingId(value); + return this; + } + + @Override + public NodeAwardSettingRecord value7(BigDecimal value) { + setRebate(value); + return this; + } + + @Override + public NodeAwardSettingRecord value8(BigDecimal value) { + setRbitAmount(value); + return this; + } + + @Override + public NodeAwardSettingRecord value9(BigDecimal value) { + setRbitOne(value); + return this; + } + + @Override + public NodeAwardSettingRecord value10(BigDecimal value) { + setRebateTwo(value); + return this; + } + + @Override + public NodeAwardSettingRecord value11(BigDecimal value) { + setNftAmount(value); + return this; + } + + @Override + public NodeAwardSettingRecord value12(BigDecimal value) { + setNftOne(value); + return this; + } + + @Override + public NodeAwardSettingRecord value13(BigDecimal value) { + setNftTwo(value); + return this; + } + + @Override + public NodeAwardSettingRecord values(Integer value1, Timestamp value2, String value3, Timestamp value4, String value5, Integer value6, BigDecimal value7, BigDecimal value8, BigDecimal value9, BigDecimal value10, BigDecimal value11, BigDecimal value12, BigDecimal value13) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeAwardSettingRecord + */ + public NodeAwardSettingRecord() { + super(NodeAwardSettingTable.NODE_AWARD_SETTING); + } + + /** + * Create a detached, initialised NodeAwardSettingRecord + */ + public NodeAwardSettingRecord(Integer id, Timestamp createTime, String createBy, Timestamp updateTime, String updateBy, Integer nodeSettingId, BigDecimal rebate, BigDecimal rbitAmount, BigDecimal rbitOne, BigDecimal rebateTwo, BigDecimal nftAmount, BigDecimal nftOne, BigDecimal nftTwo) { + super(NodeAwardSettingTable.NODE_AWARD_SETTING); + + set(0, id); + set(1, createTime); + set(2, createBy); + set(3, updateTime); + set(4, updateBy); + set(5, nodeSettingId); + set(6, rebate); + set(7, rbitAmount); + set(8, rbitOne); + set(9, rebateTwo); + set(10, nftAmount); + set(11, nftOne); + set(12, nftTwo); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeBuyLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeBuyLogRecord.java new file mode 100644 index 0000000..2520c07 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeBuyLogRecord.java @@ -0,0 +1,465 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeBuyLogTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 节点认购记录 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeBuyLogRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = 210820787; + + /** + * Setter for node_buy_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node_buy_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node_buy_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node_buy_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node_buy_log.create_by. 创建人 + */ + public void setCreateBy(String value) { + set(2, value); + } + + /** + * Getter for node_buy_log.create_by. 创建人 + */ + public String getCreateBy() { + return (String) get(2); + } + + /** + * Setter for node_buy_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(3, value); + } + + /** + * Getter for node_buy_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(3); + } + + /** + * Setter for node_buy_log.update_by. 更新人 + */ + public void setUpdateBy(String value) { + set(4, value); + } + + /** + * Getter for node_buy_log.update_by. 更新人 + */ + public String getUpdateBy() { + return (String) get(4); + } + + /** + * Setter for node_buy_log.wallet_address. 钱包地址 + */ + public void setWalletAddress(String value) { + set(5, value); + } + + /** + * Getter for node_buy_log.wallet_address. 钱包地址 + */ + public String getWalletAddress() { + return (String) get(5); + } + + /** + * Setter for node_buy_log.recommend_id. 推荐人ID + */ + public void setRecommendId(Integer value) { + set(6, value); + } + + /** + * Getter for node_buy_log.recommend_id. 推荐人ID + */ + public Integer getRecommendId() { + return (Integer) get(6); + } + + /** + * Setter for node_buy_log.indirect_user_id. 间推人ID + */ + public void setIndirectUserId(Integer value) { + set(7, value); + } + + /** + * Getter for node_buy_log.indirect_user_id. 间推人ID + */ + public Integer getIndirectUserId() { + return (Integer) get(7); + } + + /** + * Setter for node_buy_log.buy_count. 认购数量 + */ + public void setBuyCount(BigDecimal value) { + set(8, value); + } + + /** + * Getter for node_buy_log.buy_count. 认购数量 + */ + public BigDecimal getBuyCount() { + return (BigDecimal) get(8); + } + + /** + * Setter for node_buy_log.pay_coin. 支付币种 + */ + public void setPayCoin(String value) { + set(9, value); + } + + /** + * Getter for node_buy_log.pay_coin. 支付币种 + */ + public String getPayCoin() { + return (String) get(9); + } + + /** + * Setter for node_buy_log.buy_amount. 认购金额 + */ + public void setBuyAmount(BigDecimal value) { + set(10, value); + } + + /** + * Getter for node_buy_log.buy_amount. 认购金额 + */ + public BigDecimal getBuyAmount() { + return (BigDecimal) get(10); + } + + /** + * Setter for node_buy_log.node_setting_id. 节点配置ID + */ + public void setNodeSettingId(Integer value) { + set(11, value); + } + + /** + * Getter for node_buy_log.node_setting_id. 节点配置ID + */ + public Integer getNodeSettingId() { + return (Integer) get(11); + } + + /** + * Setter for node_buy_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public void setStatus(Integer value) { + set(12, value); + } + + /** + * Getter for node_buy_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public Integer getStatus() { + return (Integer) get(12); + } + + /** + * Setter for node_buy_log.user_id. 用户id + */ + public void setUserId(Integer value) { + set(13, value); + } + + /** + * Getter for node_buy_log.user_id. 用户id + */ + public Integer getUserId() { + return (Integer) get(13); + } + + /** + * Setter for node_buy_log.hash. 交易hash + */ + public void setHash(String value) { + set(14, value); + } + + /** + * Getter for node_buy_log.hash. 交易hash + */ + public String getHash() { + return (String) get(14); + } + + /** + * Setter for node_buy_log.order_number. 订单号 + */ + public void setOrderNumber(String value) { + set(15, value); + } + + /** + * Getter for node_buy_log.order_number. 订单号 + */ + public String getOrderNumber() { + return (String) get(15); + } + + /** + * Setter for node_buy_log.input_address. 出账地址 + */ + public void setInputAddress(String value) { + set(16, value); + } + + /** + * Getter for node_buy_log.input_address. 出账地址 + */ + public String getInputAddress() { + return (String) get(16); + } + + /** + * Setter for node_buy_log.out_address. 到账地址 + */ + public void setOutAddress(String value) { + set(17, value); + } + + /** + * Getter for node_buy_log.out_address. 到账地址 + */ + public String getOutAddress() { + return (String) get(17); + } + + /** + * Setter for node_buy_log.rebate. 推荐人返佣金额 + */ + public void setRebate(BigDecimal value) { + set(18, value); + } + + /** + * Getter for node_buy_log.rebate. 推荐人返佣金额 + */ + public BigDecimal getRebate() { + return (BigDecimal) get(18); + } + + /** + * Setter for node_buy_log.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public void setRbitAmount(BigDecimal value) { + set(19, value); + } + + /** + * Getter for node_buy_log.rbit_amount. 购买盒子获取Rbit奖励数量 + */ + public BigDecimal getRbitAmount() { + return (BigDecimal) get(19); + } + + /** + * Setter for node_buy_log.rbit_one. 1代Rbit奖励 + */ + public void setRbitOne(BigDecimal value) { + set(20, value); + } + + /** + * Getter for node_buy_log.rbit_one. 1代Rbit奖励 + */ + public BigDecimal getRbitOne() { + return (BigDecimal) get(20); + } + + /** + * Setter for node_buy_log.rbit_two. 2代Rbit奖励 + */ + public void setRbitTwo(BigDecimal value) { + set(21, value); + } + + /** + * Getter for node_buy_log.rbit_two. 2代Rbit奖励 + */ + public BigDecimal getRbitTwo() { + return (BigDecimal) get(21); + } + + /** + * Setter for node_buy_log.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public void setNftAmount(BigDecimal value) { + set(22, value); + } + + /** + * Getter for node_buy_log.nft_amount. 购买盒子NFT碎片奖励数量 + */ + public BigDecimal getNftAmount() { + return (BigDecimal) get(22); + } + + /** + * Setter for node_buy_log.nft_one. 1代NFT碎片奖励 + */ + public void setNftOne(BigDecimal value) { + set(23, value); + } + + /** + * Getter for node_buy_log.nft_one. 1代NFT碎片奖励 + */ + public BigDecimal getNftOne() { + return (BigDecimal) get(23); + } + + /** + * Setter for node_buy_log.nft_two. 2代NFT碎片奖励 + */ + public void setNftTwo(BigDecimal value) { + set(24, value); + } + + /** + * Getter for node_buy_log.nft_two. 2代NFT碎片奖励 + */ + public BigDecimal getNftTwo() { + return (BigDecimal) get(24); + } + + /** + * Setter for node_buy_log.illustrate. 订单说明 + */ + public void setIllustrate(String value) { + set(25, value); + } + + /** + * Getter for node_buy_log.illustrate. 订单说明 + */ + public String getIllustrate() { + return (String) get(25); + } + + /** + * Setter for node_buy_log.top_settlement. 是否结算 1=结算 0=未结算 + */ + public void setTopSettlement(Integer value) { + set(26, value); + } + + /** + * Getter for node_buy_log.top_settlement. 是否结算 1=结算 0=未结算 + */ + public Integer getTopSettlement() { + return (Integer) get(26); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeBuyLogRecord + */ + public NodeBuyLogRecord() { + super(NodeBuyLogTable.NODE_BUY_LOG); + } + + /** + * Create a detached, initialised NodeBuyLogRecord + */ + public NodeBuyLogRecord(Integer id, Timestamp createTime, String createBy, Timestamp updateTime, String updateBy, String walletAddress, Integer recommendId, Integer indirectUserId, BigDecimal buyCount, String payCoin, BigDecimal buyAmount, Integer nodeSettingId, Integer status, Integer userId, String hash, String orderNumber, String inputAddress, String outAddress, BigDecimal rebate, BigDecimal rbitAmount, BigDecimal rbitOne, BigDecimal rbitTwo, BigDecimal nftAmount, BigDecimal nftOne, BigDecimal nftTwo, String illustrate, Integer topSettlement) { + super(NodeBuyLogTable.NODE_BUY_LOG); + + set(0, id); + set(1, createTime); + set(2, createBy); + set(3, updateTime); + set(4, updateBy); + set(5, walletAddress); + set(6, recommendId); + set(7, indirectUserId); + set(8, buyCount); + set(9, payCoin); + set(10, buyAmount); + set(11, nodeSettingId); + set(12, status); + set(13, userId); + set(14, hash); + set(15, orderNumber); + set(16, inputAddress); + set(17, outAddress); + set(18, rebate); + set(19, rbitAmount); + set(20, rbitOne); + set(21, rbitTwo); + set(22, nftAmount); + set(23, nftOne); + set(24, nftTwo); + set(25, illustrate); + set(26, topSettlement); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeRecord.java new file mode 100644 index 0000000..0533010 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeRecord.java @@ -0,0 +1,563 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record13; +import org.jooq.Row13; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 用户节点表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeRecord extends UpdatableRecordImpl implements Record13 { + + private static final long serialVersionUID = -1270074651; + + /** + * Setter for node.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node.create_by. 创建人 + */ + public void setCreateBy(String value) { + set(2, value); + } + + /** + * Getter for node.create_by. 创建人 + */ + public String getCreateBy() { + return (String) get(2); + } + + /** + * Setter for node.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(3, value); + } + + /** + * Getter for node.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(3); + } + + /** + * Setter for node.update_by. 更新人 + */ + public void setUpdateBy(String value) { + set(4, value); + } + + /** + * Getter for node.update_by. 更新人 + */ + public String getUpdateBy() { + return (String) get(4); + } + + /** + * Setter for node.buy_coin. 认购币种 + */ + public void setBuyCoin(String value) { + set(5, value); + } + + /** + * Getter for node.buy_coin. 认购币种 + */ + public String getBuyCoin() { + return (String) get(5); + } + + /** + * Setter for node.buy_amount. 支付金额 + */ + public void setBuyAmount(BigDecimal value) { + set(6, value); + } + + /** + * Getter for node.buy_amount. 支付金额 + */ + public BigDecimal getBuyAmount() { + return (BigDecimal) get(6); + } + + /** + * Setter for node.buy_number. 购买数量 + */ + public void setBuyNumber(Integer value) { + set(7, value); + } + + /** + * Getter for node.buy_number. 购买数量 + */ + public Integer getBuyNumber() { + return (Integer) get(7); + } + + /** + * Setter for node.confirm_time. 确认时间 + */ + public void setConfirmTime(Timestamp value) { + set(8, value); + } + + /** + * Getter for node.confirm_time. 确认时间 + */ + public Timestamp getConfirmTime() { + return (Timestamp) get(8); + } + + /** + * Setter for node.user_id. 用户id + */ + public void setUserId(Integer value) { + set(9, value); + } + + /** + * Getter for node.user_id. 用户id + */ + public Integer getUserId() { + return (Integer) get(9); + } + + /** + * Setter for node.node_name. 节点名称 + */ + public void setNodeName(String value) { + set(10, value); + } + + /** + * Getter for node.node_name. 节点名称 + */ + public String getNodeName() { + return (String) get(10); + } + + /** + * Setter for node.order_number. 订单号 + */ + public void setOrderNumber(String value) { + set(11, value); + } + + /** + * Getter for node.order_number. 订单号 + */ + public String getOrderNumber() { + return (String) get(11); + } + + /** + * Setter for node.node_setting_id. 节点配置id + */ + public void setNodeSettingId(Integer value) { + set(12, value); + } + + /** + * Getter for node.node_setting_id. 节点配置id + */ + public Integer getNodeSettingId() { + return (Integer) get(12); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record13 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row13 fieldsRow() { + return (Row13) super.fieldsRow(); + } + + @Override + public Row13 valuesRow() { + return (Row13) super.valuesRow(); + } + + @Override + public Field field1() { + return NodeTable.NODE.ID; + } + + @Override + public Field field2() { + return NodeTable.NODE.CREATE_TIME; + } + + @Override + public Field field3() { + return NodeTable.NODE.CREATE_BY; + } + + @Override + public Field field4() { + return NodeTable.NODE.UPDATE_TIME; + } + + @Override + public Field field5() { + return NodeTable.NODE.UPDATE_BY; + } + + @Override + public Field field6() { + return NodeTable.NODE.BUY_COIN; + } + + @Override + public Field field7() { + return NodeTable.NODE.BUY_AMOUNT; + } + + @Override + public Field field8() { + return NodeTable.NODE.BUY_NUMBER; + } + + @Override + public Field field9() { + return NodeTable.NODE.CONFIRM_TIME; + } + + @Override + public Field field10() { + return NodeTable.NODE.USER_ID; + } + + @Override + public Field field11() { + return NodeTable.NODE.NODE_NAME; + } + + @Override + public Field field12() { + return NodeTable.NODE.ORDER_NUMBER; + } + + @Override + public Field field13() { + return NodeTable.NODE.NODE_SETTING_ID; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public String component3() { + return getCreateBy(); + } + + @Override + public Timestamp component4() { + return getUpdateTime(); + } + + @Override + public String component5() { + return getUpdateBy(); + } + + @Override + public String component6() { + return getBuyCoin(); + } + + @Override + public BigDecimal component7() { + return getBuyAmount(); + } + + @Override + public Integer component8() { + return getBuyNumber(); + } + + @Override + public Timestamp component9() { + return getConfirmTime(); + } + + @Override + public Integer component10() { + return getUserId(); + } + + @Override + public String component11() { + return getNodeName(); + } + + @Override + public String component12() { + return getOrderNumber(); + } + + @Override + public Integer component13() { + return getNodeSettingId(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public String value3() { + return getCreateBy(); + } + + @Override + public Timestamp value4() { + return getUpdateTime(); + } + + @Override + public String value5() { + return getUpdateBy(); + } + + @Override + public String value6() { + return getBuyCoin(); + } + + @Override + public BigDecimal value7() { + return getBuyAmount(); + } + + @Override + public Integer value8() { + return getBuyNumber(); + } + + @Override + public Timestamp value9() { + return getConfirmTime(); + } + + @Override + public Integer value10() { + return getUserId(); + } + + @Override + public String value11() { + return getNodeName(); + } + + @Override + public String value12() { + return getOrderNumber(); + } + + @Override + public Integer value13() { + return getNodeSettingId(); + } + + @Override + public NodeRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public NodeRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public NodeRecord value3(String value) { + setCreateBy(value); + return this; + } + + @Override + public NodeRecord value4(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public NodeRecord value5(String value) { + setUpdateBy(value); + return this; + } + + @Override + public NodeRecord value6(String value) { + setBuyCoin(value); + return this; + } + + @Override + public NodeRecord value7(BigDecimal value) { + setBuyAmount(value); + return this; + } + + @Override + public NodeRecord value8(Integer value) { + setBuyNumber(value); + return this; + } + + @Override + public NodeRecord value9(Timestamp value) { + setConfirmTime(value); + return this; + } + + @Override + public NodeRecord value10(Integer value) { + setUserId(value); + return this; + } + + @Override + public NodeRecord value11(String value) { + setNodeName(value); + return this; + } + + @Override + public NodeRecord value12(String value) { + setOrderNumber(value); + return this; + } + + @Override + public NodeRecord value13(Integer value) { + setNodeSettingId(value); + return this; + } + + @Override + public NodeRecord values(Integer value1, Timestamp value2, String value3, Timestamp value4, String value5, String value6, BigDecimal value7, Integer value8, Timestamp value9, Integer value10, String value11, String value12, Integer value13) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeRecord + */ + public NodeRecord() { + super(NodeTable.NODE); + } + + /** + * Create a detached, initialised NodeRecord + */ + public NodeRecord(Integer id, Timestamp createTime, String createBy, Timestamp updateTime, String updateBy, String buyCoin, BigDecimal buyAmount, Integer buyNumber, Timestamp confirmTime, Integer userId, String nodeName, String orderNumber, Integer nodeSettingId) { + super(NodeTable.NODE); + + set(0, id); + set(1, createTime); + set(2, createBy); + set(3, updateTime); + set(4, updateBy); + set(5, buyCoin); + set(6, buyAmount); + set(7, buyNumber); + set(8, confirmTime); + set(9, userId); + set(10, nodeName); + set(11, orderNumber); + set(12, nodeSettingId); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeSettingRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeSettingRecord.java new file mode 100644 index 0000000..82238a9 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeSettingRecord.java @@ -0,0 +1,674 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeSettingTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record16; +import org.jooq.Row16; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 节点设置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeSettingRecord extends UpdatableRecordImpl implements Record16 { + + private static final long serialVersionUID = -1500169451; + + /** + * Setter for node_setting.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node_setting.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node_setting.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node_setting.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node_setting.create_by. 创建人 + */ + public void setCreateBy(String value) { + set(2, value); + } + + /** + * Getter for node_setting.create_by. 创建人 + */ + public String getCreateBy() { + return (String) get(2); + } + + /** + * Setter for node_setting.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(3, value); + } + + /** + * Getter for node_setting.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(3); + } + + /** + * Setter for node_setting.update_by. 更新人 + */ + public void setUpdateBy(String value) { + set(4, value); + } + + /** + * Getter for node_setting.update_by. 更新人 + */ + public String getUpdateBy() { + return (String) get(4); + } + + /** + * Setter for node_setting.buy_coin_name. 认购币种 + */ + public void setBuyCoinName(String value) { + set(5, value); + } + + /** + * Getter for node_setting.buy_coin_name. 认购币种 + */ + public String getBuyCoinName() { + return (String) get(5); + } + + /** + * Setter for node_setting.node_total. 节点总量 + */ + public void setNodeTotal(Integer value) { + set(6, value); + } + + /** + * Getter for node_setting.node_total. 节点总量 + */ + public Integer getNodeTotal() { + return (Integer) get(6); + } + + /** + * Setter for node_setting.node_price. 节点价格 + */ + public void setNodePrice(BigDecimal value) { + set(7, value); + } + + /** + * Getter for node_setting.node_price. 节点价格 + */ + public BigDecimal getNodePrice() { + return (BigDecimal) get(7); + } + + /** + * Setter for node_setting.purchase_limit. 单地址限购数量 + */ + public void setPurchaseLimit(Integer value) { + set(8, value); + } + + /** + * Getter for node_setting.purchase_limit. 单地址限购数量 + */ + public Integer getPurchaseLimit() { + return (Integer) get(8); + } + + /** + * Setter for node_setting.purchased_count. 已购数量 + */ + public void setPurchasedCount(Integer value) { + set(9, value); + } + + /** + * Getter for node_setting.purchased_count. 已购数量 + */ + public Integer getPurchasedCount() { + return (Integer) get(9); + } + + /** + * Setter for node_setting.purchased_amount. 已购金额 + */ + public void setPurchasedAmount(BigDecimal value) { + set(10, value); + } + + /** + * Getter for node_setting.purchased_amount. 已购金额 + */ + public BigDecimal getPurchasedAmount() { + return (BigDecimal) get(10); + } + + /** + * Setter for node_setting.status. 当前状态:1:认购中;2:已完成;3:待认购 + */ + public void setStatus(Integer value) { + set(11, value); + } + + /** + * Getter for node_setting.status. 当前状态:1:认购中;2:已完成;3:待认购 + */ + public Integer getStatus() { + return (Integer) get(11); + } + + /** + * Setter for node_setting.node_name. 节点名称 + */ + public void setNodeName(String value) { + set(12, value); + } + + /** + * Getter for node_setting.node_name. 节点名称 + */ + public String getNodeName() { + return (String) get(12); + } + + /** + * Setter for node_setting.illustrate. 节点说明 + */ + public void setIllustrate(String value) { + set(13, value); + } + + /** + * Getter for node_setting.illustrate. 节点说明 + */ + public String getIllustrate() { + return (String) get(13); + } + + /** + * Setter for node_setting.title. 标题 + */ + public void setTitle(String value) { + set(14, value); + } + + /** + * Getter for node_setting.title. 标题 + */ + public String getTitle() { + return (String) get(14); + } + + /** + * Setter for node_setting.node_grade. 节点等级 + */ + public void setNodeGrade(String value) { + set(15, value); + } + + /** + * Getter for node_setting.node_grade. 节点等级 + */ + public String getNodeGrade() { + return (String) get(15); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record16 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } + + @Override + public Row16 valuesRow() { + return (Row16) super.valuesRow(); + } + + @Override + public Field field1() { + return NodeSettingTable.NODE_SETTING.ID; + } + + @Override + public Field field2() { + return NodeSettingTable.NODE_SETTING.CREATE_TIME; + } + + @Override + public Field field3() { + return NodeSettingTable.NODE_SETTING.CREATE_BY; + } + + @Override + public Field field4() { + return NodeSettingTable.NODE_SETTING.UPDATE_TIME; + } + + @Override + public Field field5() { + return NodeSettingTable.NODE_SETTING.UPDATE_BY; + } + + @Override + public Field field6() { + return NodeSettingTable.NODE_SETTING.BUY_COIN_NAME; + } + + @Override + public Field field7() { + return NodeSettingTable.NODE_SETTING.NODE_TOTAL; + } + + @Override + public Field field8() { + return NodeSettingTable.NODE_SETTING.NODE_PRICE; + } + + @Override + public Field field9() { + return NodeSettingTable.NODE_SETTING.PURCHASE_LIMIT; + } + + @Override + public Field field10() { + return NodeSettingTable.NODE_SETTING.PURCHASED_COUNT; + } + + @Override + public Field field11() { + return NodeSettingTable.NODE_SETTING.PURCHASED_AMOUNT; + } + + @Override + public Field field12() { + return NodeSettingTable.NODE_SETTING.STATUS; + } + + @Override + public Field field13() { + return NodeSettingTable.NODE_SETTING.NODE_NAME; + } + + @Override + public Field field14() { + return NodeSettingTable.NODE_SETTING.ILLUSTRATE; + } + + @Override + public Field field15() { + return NodeSettingTable.NODE_SETTING.TITLE; + } + + @Override + public Field field16() { + return NodeSettingTable.NODE_SETTING.NODE_GRADE; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public String component3() { + return getCreateBy(); + } + + @Override + public Timestamp component4() { + return getUpdateTime(); + } + + @Override + public String component5() { + return getUpdateBy(); + } + + @Override + public String component6() { + return getBuyCoinName(); + } + + @Override + public Integer component7() { + return getNodeTotal(); + } + + @Override + public BigDecimal component8() { + return getNodePrice(); + } + + @Override + public Integer component9() { + return getPurchaseLimit(); + } + + @Override + public Integer component10() { + return getPurchasedCount(); + } + + @Override + public BigDecimal component11() { + return getPurchasedAmount(); + } + + @Override + public Integer component12() { + return getStatus(); + } + + @Override + public String component13() { + return getNodeName(); + } + + @Override + public String component14() { + return getIllustrate(); + } + + @Override + public String component15() { + return getTitle(); + } + + @Override + public String component16() { + return getNodeGrade(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public String value3() { + return getCreateBy(); + } + + @Override + public Timestamp value4() { + return getUpdateTime(); + } + + @Override + public String value5() { + return getUpdateBy(); + } + + @Override + public String value6() { + return getBuyCoinName(); + } + + @Override + public Integer value7() { + return getNodeTotal(); + } + + @Override + public BigDecimal value8() { + return getNodePrice(); + } + + @Override + public Integer value9() { + return getPurchaseLimit(); + } + + @Override + public Integer value10() { + return getPurchasedCount(); + } + + @Override + public BigDecimal value11() { + return getPurchasedAmount(); + } + + @Override + public Integer value12() { + return getStatus(); + } + + @Override + public String value13() { + return getNodeName(); + } + + @Override + public String value14() { + return getIllustrate(); + } + + @Override + public String value15() { + return getTitle(); + } + + @Override + public String value16() { + return getNodeGrade(); + } + + @Override + public NodeSettingRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public NodeSettingRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public NodeSettingRecord value3(String value) { + setCreateBy(value); + return this; + } + + @Override + public NodeSettingRecord value4(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public NodeSettingRecord value5(String value) { + setUpdateBy(value); + return this; + } + + @Override + public NodeSettingRecord value6(String value) { + setBuyCoinName(value); + return this; + } + + @Override + public NodeSettingRecord value7(Integer value) { + setNodeTotal(value); + return this; + } + + @Override + public NodeSettingRecord value8(BigDecimal value) { + setNodePrice(value); + return this; + } + + @Override + public NodeSettingRecord value9(Integer value) { + setPurchaseLimit(value); + return this; + } + + @Override + public NodeSettingRecord value10(Integer value) { + setPurchasedCount(value); + return this; + } + + @Override + public NodeSettingRecord value11(BigDecimal value) { + setPurchasedAmount(value); + return this; + } + + @Override + public NodeSettingRecord value12(Integer value) { + setStatus(value); + return this; + } + + @Override + public NodeSettingRecord value13(String value) { + setNodeName(value); + return this; + } + + @Override + public NodeSettingRecord value14(String value) { + setIllustrate(value); + return this; + } + + @Override + public NodeSettingRecord value15(String value) { + setTitle(value); + return this; + } + + @Override + public NodeSettingRecord value16(String value) { + setNodeGrade(value); + return this; + } + + @Override + public NodeSettingRecord values(Integer value1, Timestamp value2, String value3, Timestamp value4, String value5, String value6, Integer value7, BigDecimal value8, Integer value9, Integer value10, BigDecimal value11, Integer value12, String value13, String value14, String value15, String value16) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + value15(value15); + value16(value16); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeSettingRecord + */ + public NodeSettingRecord() { + super(NodeSettingTable.NODE_SETTING); + } + + /** + * Create a detached, initialised NodeSettingRecord + */ + public NodeSettingRecord(Integer id, Timestamp createTime, String createBy, Timestamp updateTime, String updateBy, String buyCoinName, Integer nodeTotal, BigDecimal nodePrice, Integer purchaseLimit, Integer purchasedCount, BigDecimal purchasedAmount, Integer status, String nodeName, String illustrate, String title, String nodeGrade) { + super(NodeSettingTable.NODE_SETTING); + + set(0, id); + set(1, createTime); + set(2, createBy); + set(3, updateTime); + set(4, updateBy); + set(5, buyCoinName); + set(6, nodeTotal); + set(7, nodePrice); + set(8, purchaseLimit); + set(9, purchasedCount); + set(10, purchasedAmount); + set(11, status); + set(12, nodeName); + set(13, illustrate); + set(14, title); + set(15, nodeGrade); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskLogRecord.java new file mode 100644 index 0000000..caad02b --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskLogRecord.java @@ -0,0 +1,452 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeTaskLogTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record10; +import org.jooq.Row10; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 我的任务奖励 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskLogRecord extends UpdatableRecordImpl implements Record10 { + + private static final long serialVersionUID = -93867020; + + /** + * Setter for node_task_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node_task_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node_task_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node_task_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node_task_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for node_task_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for node_task_log.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for node_task_log.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for node_task_log.task_id. 任务id + */ + public void setTaskId(Integer value) { + set(4, value); + } + + /** + * Getter for node_task_log.task_id. 任务id + */ + public Integer getTaskId() { + return (Integer) get(4); + } + + /** + * Setter for node_task_log.member_id. 会员id + */ + public void setMemberId(Integer value) { + set(5, value); + } + + /** + * Getter for node_task_log.member_id. 会员id + */ + public Integer getMemberId() { + return (Integer) get(5); + } + + /** + * Setter for node_task_log.state. 0=待确认 1=待领取 2=已领取 + */ + public void setState(Integer value) { + set(6, value); + } + + /** + * Getter for node_task_log.state. 0=待确认 1=待领取 2=已领取 + */ + public Integer getState() { + return (Integer) get(6); + } + + /** + * Setter for node_task_log.award_value. 奖励积分数量 + */ + public void setAwardValue(BigDecimal value) { + set(7, value); + } + + /** + * Getter for node_task_log.award_value. 奖励积分数量 + */ + public BigDecimal getAwardValue() { + return (BigDecimal) get(7); + } + + /** + * Setter for node_task_log.coin_name. 奖励币种 + */ + public void setCoinName(String value) { + set(8, value); + } + + /** + * Getter for node_task_log.coin_name. 奖励币种 + */ + public String getCoinName() { + return (String) get(8); + } + + /** + * Setter for node_task_log.recommend_value. 推荐人奖励 + */ + public void setRecommendValue(BigDecimal value) { + set(9, value); + } + + /** + * Getter for node_task_log.recommend_value. 推荐人奖励 + */ + public BigDecimal getRecommendValue() { + return (BigDecimal) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record10 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row10 fieldsRow() { + return (Row10) super.fieldsRow(); + } + + @Override + public Row10 valuesRow() { + return (Row10) super.valuesRow(); + } + + @Override + public Field field1() { + return NodeTaskLogTable.NODE_TASK_LOG.ID; + } + + @Override + public Field field2() { + return NodeTaskLogTable.NODE_TASK_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return NodeTaskLogTable.NODE_TASK_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return NodeTaskLogTable.NODE_TASK_LOG.FLAG; + } + + @Override + public Field field5() { + return NodeTaskLogTable.NODE_TASK_LOG.TASK_ID; + } + + @Override + public Field field6() { + return NodeTaskLogTable.NODE_TASK_LOG.MEMBER_ID; + } + + @Override + public Field field7() { + return NodeTaskLogTable.NODE_TASK_LOG.STATE; + } + + @Override + public Field field8() { + return NodeTaskLogTable.NODE_TASK_LOG.AWARD_VALUE; + } + + @Override + public Field field9() { + return NodeTaskLogTable.NODE_TASK_LOG.COIN_NAME; + } + + @Override + public Field field10() { + return NodeTaskLogTable.NODE_TASK_LOG.RECOMMEND_VALUE; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getTaskId(); + } + + @Override + public Integer component6() { + return getMemberId(); + } + + @Override + public Integer component7() { + return getState(); + } + + @Override + public BigDecimal component8() { + return getAwardValue(); + } + + @Override + public String component9() { + return getCoinName(); + } + + @Override + public BigDecimal component10() { + return getRecommendValue(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getTaskId(); + } + + @Override + public Integer value6() { + return getMemberId(); + } + + @Override + public Integer value7() { + return getState(); + } + + @Override + public BigDecimal value8() { + return getAwardValue(); + } + + @Override + public String value9() { + return getCoinName(); + } + + @Override + public BigDecimal value10() { + return getRecommendValue(); + } + + @Override + public NodeTaskLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public NodeTaskLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public NodeTaskLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public NodeTaskLogRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public NodeTaskLogRecord value5(Integer value) { + setTaskId(value); + return this; + } + + @Override + public NodeTaskLogRecord value6(Integer value) { + setMemberId(value); + return this; + } + + @Override + public NodeTaskLogRecord value7(Integer value) { + setState(value); + return this; + } + + @Override + public NodeTaskLogRecord value8(BigDecimal value) { + setAwardValue(value); + return this; + } + + @Override + public NodeTaskLogRecord value9(String value) { + setCoinName(value); + return this; + } + + @Override + public NodeTaskLogRecord value10(BigDecimal value) { + setRecommendValue(value); + return this; + } + + @Override + public NodeTaskLogRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, Integer value6, Integer value7, BigDecimal value8, String value9, BigDecimal value10) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeTaskLogRecord + */ + public NodeTaskLogRecord() { + super(NodeTaskLogTable.NODE_TASK_LOG); + } + + /** + * Create a detached, initialised NodeTaskLogRecord + */ + public NodeTaskLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer taskId, Integer memberId, Integer state, BigDecimal awardValue, String coinName, BigDecimal recommendValue) { + super(NodeTaskLogTable.NODE_TASK_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, taskId); + set(5, memberId); + set(6, state); + set(7, awardValue); + set(8, coinName); + set(9, recommendValue); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskRecord.java new file mode 100644 index 0000000..7eee8f6 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/NodeTaskRecord.java @@ -0,0 +1,452 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.NodeTaskTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record10; +import org.jooq.Row10; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * NEER任务配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class NodeTaskRecord extends UpdatableRecordImpl implements Record10 { + + private static final long serialVersionUID = -1474418718; + + /** + * Setter for node_task.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for node_task.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for node_task.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for node_task.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for node_task.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for node_task.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for node_task.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for node_task.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for node_task.type. 类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分 + */ + public void setType(Integer value) { + set(4, value); + } + + /** + * Getter for node_task.type. 类型,1链接钱包,2关注推特 3:加入TG 4加入Discord 5邀请获得积分 + */ + public Integer getType() { + return (Integer) get(4); + } + + /** + * Setter for node_task.title. 名称,没什么用,方便看数据库 + */ + public void setTitle(String value) { + set(5, value); + } + + /** + * Getter for node_task.title. 名称,没什么用,方便看数据库 + */ + public String getTitle() { + return (String) get(5); + } + + /** + * Setter for node_task.award_value. 奖励数量 + */ + public void setAwardValue(BigDecimal value) { + set(6, value); + } + + /** + * Getter for node_task.award_value. 奖励数量 + */ + public BigDecimal getAwardValue() { + return (BigDecimal) get(6); + } + + /** + * Setter for node_task.recommend_value. 推荐人奖励 + */ + public void setRecommendValue(BigDecimal value) { + set(7, value); + } + + /** + * Getter for node_task.recommend_value. 推荐人奖励 + */ + public BigDecimal getRecommendValue() { + return (BigDecimal) get(7); + } + + /** + * Setter for node_task.type2_target. 类型2的任务目标,其它类型忽略 + */ + public void setType2Target(Integer value) { + set(8, value); + } + + /** + * Getter for node_task.type2_target. 类型2的任务目标,其它类型忽略 + */ + public Integer getType2Target() { + return (Integer) get(8); + } + + /** + * Setter for node_task.coin_id. 奖励币种iD(0=战力) + */ + public void setCoinId(Integer value) { + set(9, value); + } + + /** + * Getter for node_task.coin_id. 奖励币种iD(0=战力) + */ + public Integer getCoinId() { + return (Integer) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record10 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row10 fieldsRow() { + return (Row10) super.fieldsRow(); + } + + @Override + public Row10 valuesRow() { + return (Row10) super.valuesRow(); + } + + @Override + public Field field1() { + return NodeTaskTable.NODE_TASK.ID; + } + + @Override + public Field field2() { + return NodeTaskTable.NODE_TASK.CREATE_TIME; + } + + @Override + public Field field3() { + return NodeTaskTable.NODE_TASK.UPDATE_TIME; + } + + @Override + public Field field4() { + return NodeTaskTable.NODE_TASK.FLAG; + } + + @Override + public Field field5() { + return NodeTaskTable.NODE_TASK.TYPE; + } + + @Override + public Field field6() { + return NodeTaskTable.NODE_TASK.TITLE; + } + + @Override + public Field field7() { + return NodeTaskTable.NODE_TASK.AWARD_VALUE; + } + + @Override + public Field field8() { + return NodeTaskTable.NODE_TASK.RECOMMEND_VALUE; + } + + @Override + public Field field9() { + return NodeTaskTable.NODE_TASK.TYPE2_TARGET; + } + + @Override + public Field field10() { + return NodeTaskTable.NODE_TASK.COIN_ID; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getType(); + } + + @Override + public String component6() { + return getTitle(); + } + + @Override + public BigDecimal component7() { + return getAwardValue(); + } + + @Override + public BigDecimal component8() { + return getRecommendValue(); + } + + @Override + public Integer component9() { + return getType2Target(); + } + + @Override + public Integer component10() { + return getCoinId(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getType(); + } + + @Override + public String value6() { + return getTitle(); + } + + @Override + public BigDecimal value7() { + return getAwardValue(); + } + + @Override + public BigDecimal value8() { + return getRecommendValue(); + } + + @Override + public Integer value9() { + return getType2Target(); + } + + @Override + public Integer value10() { + return getCoinId(); + } + + @Override + public NodeTaskRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public NodeTaskRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public NodeTaskRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public NodeTaskRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public NodeTaskRecord value5(Integer value) { + setType(value); + return this; + } + + @Override + public NodeTaskRecord value6(String value) { + setTitle(value); + return this; + } + + @Override + public NodeTaskRecord value7(BigDecimal value) { + setAwardValue(value); + return this; + } + + @Override + public NodeTaskRecord value8(BigDecimal value) { + setRecommendValue(value); + return this; + } + + @Override + public NodeTaskRecord value9(Integer value) { + setType2Target(value); + return this; + } + + @Override + public NodeTaskRecord value10(Integer value) { + setCoinId(value); + return this; + } + + @Override + public NodeTaskRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, String value6, BigDecimal value7, BigDecimal value8, Integer value9, Integer value10) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached NodeTaskRecord + */ + public NodeTaskRecord() { + super(NodeTaskTable.NODE_TASK); + } + + /** + * Create a detached, initialised NodeTaskRecord + */ + public NodeTaskRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer type, String title, BigDecimal awardValue, BigDecimal recommendValue, Integer type2Target, Integer coinId) { + super(NodeTaskTable.NODE_TASK); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, type); + set(5, title); + set(6, awardValue); + set(7, recommendValue); + set(8, type2Target); + set(9, coinId); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/PayCoinLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/PayCoinLogRecord.java new file mode 100644 index 0000000..3372122 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/PayCoinLogRecord.java @@ -0,0 +1,637 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.PayCoinLogTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record15; +import org.jooq.Row15; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 兑换币种日志表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class PayCoinLogRecord extends UpdatableRecordImpl implements Record15 { + + private static final long serialVersionUID = -122023844; + + /** + * Setter for pay_coin_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for pay_coin_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for pay_coin_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for pay_coin_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for pay_coin_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for pay_coin_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for pay_coin_log.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for pay_coin_log.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for pay_coin_log.member_id. 用户ID + */ + public void setMemberId(Integer value) { + set(4, value); + } + + /** + * Getter for pay_coin_log.member_id. 用户ID + */ + public Integer getMemberId() { + return (Integer) get(4); + } + + /** + * Setter for pay_coin_log.address. 用户地址 + */ + public void setAddress(String value) { + set(5, value); + } + + /** + * Getter for pay_coin_log.address. 用户地址 + */ + public String getAddress() { + return (String) get(5); + } + + /** + * Setter for pay_coin_log.coin_id. 购买币种ID + */ + public void setCoinId(Integer value) { + set(6, value); + } + + /** + * Getter for pay_coin_log.coin_id. 购买币种ID + */ + public Integer getCoinId() { + return (Integer) get(6); + } + + /** + * Setter for pay_coin_log.coin_name. 币种名称 + */ + public void setCoinName(String value) { + set(7, value); + } + + /** + * Getter for pay_coin_log.coin_name. 币种名称 + */ + public String getCoinName() { + return (String) get(7); + } + + /** + * Setter for pay_coin_log.pay_usdt. 支付USDT金额 + */ + public void setPayUsdt(BigDecimal value) { + set(8, value); + } + + /** + * Getter for pay_coin_log.pay_usdt. 支付USDT金额 + */ + public BigDecimal getPayUsdt() { + return (BigDecimal) get(8); + } + + /** + * Setter for pay_coin_log.amount. 到账金额 + */ + public void setAmount(BigDecimal value) { + set(9, value); + } + + /** + * Getter for pay_coin_log.amount. 到账金额 + */ + public BigDecimal getAmount() { + return (BigDecimal) get(9); + } + + /** + * Setter for pay_coin_log.unit_price. 单价 + */ + public void setUnitPrice(BigDecimal value) { + set(10, value); + } + + /** + * Getter for pay_coin_log.unit_price. 单价 + */ + public BigDecimal getUnitPrice() { + return (BigDecimal) get(10); + } + + /** + * Setter for pay_coin_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public void setStatus(Integer value) { + set(11, value); + } + + /** + * Getter for pay_coin_log.status. 1:订单生成 2:链上确认 3:支付成功 4:支付失败 + */ + public Integer getStatus() { + return (Integer) get(11); + } + + /** + * Setter for pay_coin_log.hash. 交易hash + */ + public void setHash(String value) { + set(12, value); + } + + /** + * Getter for pay_coin_log.hash. 交易hash + */ + public String getHash() { + return (String) get(12); + } + + /** + * Setter for pay_coin_log.order_number. 订单号 + */ + public void setOrderNumber(String value) { + set(13, value); + } + + /** + * Getter for pay_coin_log.order_number. 订单号 + */ + public String getOrderNumber() { + return (String) get(13); + } + + /** + * Setter for pay_coin_log.illustrate. 订单说明 + */ + public void setIllustrate(String value) { + set(14, value); + } + + /** + * Getter for pay_coin_log.illustrate. 订单说明 + */ + public String getIllustrate() { + return (String) get(14); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record15 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row15 fieldsRow() { + return (Row15) super.fieldsRow(); + } + + @Override + public Row15 valuesRow() { + return (Row15) super.valuesRow(); + } + + @Override + public Field field1() { + return PayCoinLogTable.PAY_COIN_LOG.ID; + } + + @Override + public Field field2() { + return PayCoinLogTable.PAY_COIN_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return PayCoinLogTable.PAY_COIN_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return PayCoinLogTable.PAY_COIN_LOG.FLAG; + } + + @Override + public Field field5() { + return PayCoinLogTable.PAY_COIN_LOG.MEMBER_ID; + } + + @Override + public Field field6() { + return PayCoinLogTable.PAY_COIN_LOG.ADDRESS; + } + + @Override + public Field field7() { + return PayCoinLogTable.PAY_COIN_LOG.COIN_ID; + } + + @Override + public Field field8() { + return PayCoinLogTable.PAY_COIN_LOG.COIN_NAME; + } + + @Override + public Field field9() { + return PayCoinLogTable.PAY_COIN_LOG.PAY_USDT; + } + + @Override + public Field field10() { + return PayCoinLogTable.PAY_COIN_LOG.AMOUNT; + } + + @Override + public Field field11() { + return PayCoinLogTable.PAY_COIN_LOG.UNIT_PRICE; + } + + @Override + public Field field12() { + return PayCoinLogTable.PAY_COIN_LOG.STATUS; + } + + @Override + public Field field13() { + return PayCoinLogTable.PAY_COIN_LOG.HASH; + } + + @Override + public Field field14() { + return PayCoinLogTable.PAY_COIN_LOG.ORDER_NUMBER; + } + + @Override + public Field field15() { + return PayCoinLogTable.PAY_COIN_LOG.ILLUSTRATE; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getMemberId(); + } + + @Override + public String component6() { + return getAddress(); + } + + @Override + public Integer component7() { + return getCoinId(); + } + + @Override + public String component8() { + return getCoinName(); + } + + @Override + public BigDecimal component9() { + return getPayUsdt(); + } + + @Override + public BigDecimal component10() { + return getAmount(); + } + + @Override + public BigDecimal component11() { + return getUnitPrice(); + } + + @Override + public Integer component12() { + return getStatus(); + } + + @Override + public String component13() { + return getHash(); + } + + @Override + public String component14() { + return getOrderNumber(); + } + + @Override + public String component15() { + return getIllustrate(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getMemberId(); + } + + @Override + public String value6() { + return getAddress(); + } + + @Override + public Integer value7() { + return getCoinId(); + } + + @Override + public String value8() { + return getCoinName(); + } + + @Override + public BigDecimal value9() { + return getPayUsdt(); + } + + @Override + public BigDecimal value10() { + return getAmount(); + } + + @Override + public BigDecimal value11() { + return getUnitPrice(); + } + + @Override + public Integer value12() { + return getStatus(); + } + + @Override + public String value13() { + return getHash(); + } + + @Override + public String value14() { + return getOrderNumber(); + } + + @Override + public String value15() { + return getIllustrate(); + } + + @Override + public PayCoinLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public PayCoinLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public PayCoinLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public PayCoinLogRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public PayCoinLogRecord value5(Integer value) { + setMemberId(value); + return this; + } + + @Override + public PayCoinLogRecord value6(String value) { + setAddress(value); + return this; + } + + @Override + public PayCoinLogRecord value7(Integer value) { + setCoinId(value); + return this; + } + + @Override + public PayCoinLogRecord value8(String value) { + setCoinName(value); + return this; + } + + @Override + public PayCoinLogRecord value9(BigDecimal value) { + setPayUsdt(value); + return this; + } + + @Override + public PayCoinLogRecord value10(BigDecimal value) { + setAmount(value); + return this; + } + + @Override + public PayCoinLogRecord value11(BigDecimal value) { + setUnitPrice(value); + return this; + } + + @Override + public PayCoinLogRecord value12(Integer value) { + setStatus(value); + return this; + } + + @Override + public PayCoinLogRecord value13(String value) { + setHash(value); + return this; + } + + @Override + public PayCoinLogRecord value14(String value) { + setOrderNumber(value); + return this; + } + + @Override + public PayCoinLogRecord value15(String value) { + setIllustrate(value); + return this; + } + + @Override + public PayCoinLogRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, String value6, Integer value7, String value8, BigDecimal value9, BigDecimal value10, BigDecimal value11, Integer value12, String value13, String value14, String value15) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + value15(value15); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached PayCoinLogRecord + */ + public PayCoinLogRecord() { + super(PayCoinLogTable.PAY_COIN_LOG); + } + + /** + * Create a detached, initialised PayCoinLogRecord + */ + public PayCoinLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer memberId, String address, Integer coinId, String coinName, BigDecimal payUsdt, BigDecimal amount, BigDecimal unitPrice, Integer status, String hash, String orderNumber, String illustrate) { + super(PayCoinLogTable.PAY_COIN_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, memberId); + set(5, address); + set(6, coinId); + set(7, coinName); + set(8, payUsdt); + set(9, amount); + set(10, unitPrice); + set(11, status); + set(12, hash); + set(13, orderNumber); + set(14, illustrate); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysAccountRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysAccountRecord.java new file mode 100644 index 0000000..4d07bab --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysAccountRecord.java @@ -0,0 +1,488 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.SysAccountTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record11; +import org.jooq.Row11; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 系统账户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysAccountRecord extends UpdatableRecordImpl implements Record11 { + + private static final long serialVersionUID = -1278637580; + + /** + * Setter for sys_account.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for sys_account.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for sys_account.create_time. + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for sys_account.create_time. + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for sys_account.update_time. + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for sys_account.update_time. + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for sys_account.flag. 1正常,0删除 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for sys_account.flag. 1正常,0删除 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for sys_account.account. 账户 + */ + public void setAccount(String value) { + set(4, value); + } + + /** + * Getter for sys_account.account. 账户 + */ + public String getAccount() { + return (String) get(4); + } + + /** + * Setter for sys_account.name. 名字 + */ + public void setName(String value) { + set(5, value); + } + + /** + * Getter for sys_account.name. 名字 + */ + public String getName() { + return (String) get(5); + } + + /** + * Setter for sys_account.password. 密码 + */ + public void setPassword(String value) { + set(6, value); + } + + /** + * Getter for sys_account.password. 密码 + */ + public String getPassword() { + return (String) get(6); + } + + /** + * Setter for sys_account.status. 状态,0冻结 + */ + public void setStatus(Byte value) { + set(7, value); + } + + /** + * Getter for sys_account.status. 状态,0冻结 + */ + public Byte getStatus() { + return (Byte) get(7); + } + + /** + * Setter for sys_account.email. 邮箱 + */ + public void setEmail(String value) { + set(8, value); + } + + /** + * Getter for sys_account.email. 邮箱 + */ + public String getEmail() { + return (String) get(8); + } + + /** + * Setter for sys_account.role_id. + */ + public void setRoleId(Integer value) { + set(9, value); + } + + /** + * Getter for sys_account.role_id. + */ + public Integer getRoleId() { + return (Integer) get(9); + } + + /** + * Setter for sys_account.address. 地址 + */ + public void setAddress(String value) { + set(10, value); + } + + /** + * Getter for sys_account.address. 地址 + */ + public String getAddress() { + return (String) get(10); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record11 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row11 fieldsRow() { + return (Row11) super.fieldsRow(); + } + + @Override + public Row11 valuesRow() { + return (Row11) super.valuesRow(); + } + + @Override + public Field field1() { + return SysAccountTable.SYS_ACCOUNT.ID; + } + + @Override + public Field field2() { + return SysAccountTable.SYS_ACCOUNT.CREATE_TIME; + } + + @Override + public Field field3() { + return SysAccountTable.SYS_ACCOUNT.UPDATE_TIME; + } + + @Override + public Field field4() { + return SysAccountTable.SYS_ACCOUNT.FLAG; + } + + @Override + public Field field5() { + return SysAccountTable.SYS_ACCOUNT.ACCOUNT; + } + + @Override + public Field field6() { + return SysAccountTable.SYS_ACCOUNT.NAME; + } + + @Override + public Field field7() { + return SysAccountTable.SYS_ACCOUNT.PASSWORD; + } + + @Override + public Field field8() { + return SysAccountTable.SYS_ACCOUNT.STATUS; + } + + @Override + public Field field9() { + return SysAccountTable.SYS_ACCOUNT.EMAIL; + } + + @Override + public Field field10() { + return SysAccountTable.SYS_ACCOUNT.ROLE_ID; + } + + @Override + public Field field11() { + return SysAccountTable.SYS_ACCOUNT.ADDRESS; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getAccount(); + } + + @Override + public String component6() { + return getName(); + } + + @Override + public String component7() { + return getPassword(); + } + + @Override + public Byte component8() { + return getStatus(); + } + + @Override + public String component9() { + return getEmail(); + } + + @Override + public Integer component10() { + return getRoleId(); + } + + @Override + public String component11() { + return getAddress(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getAccount(); + } + + @Override + public String value6() { + return getName(); + } + + @Override + public String value7() { + return getPassword(); + } + + @Override + public Byte value8() { + return getStatus(); + } + + @Override + public String value9() { + return getEmail(); + } + + @Override + public Integer value10() { + return getRoleId(); + } + + @Override + public String value11() { + return getAddress(); + } + + @Override + public SysAccountRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public SysAccountRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public SysAccountRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public SysAccountRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public SysAccountRecord value5(String value) { + setAccount(value); + return this; + } + + @Override + public SysAccountRecord value6(String value) { + setName(value); + return this; + } + + @Override + public SysAccountRecord value7(String value) { + setPassword(value); + return this; + } + + @Override + public SysAccountRecord value8(Byte value) { + setStatus(value); + return this; + } + + @Override + public SysAccountRecord value9(String value) { + setEmail(value); + return this; + } + + @Override + public SysAccountRecord value10(Integer value) { + setRoleId(value); + return this; + } + + @Override + public SysAccountRecord value11(String value) { + setAddress(value); + return this; + } + + @Override + public SysAccountRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, String value7, Byte value8, String value9, Integer value10, String value11) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached SysAccountRecord + */ + public SysAccountRecord() { + super(SysAccountTable.SYS_ACCOUNT); + } + + /** + * Create a detached, initialised SysAccountRecord + */ + public SysAccountRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String account, String name, String password, Byte status, String email, Integer roleId, String address) { + super(SysAccountTable.SYS_ACCOUNT); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, account); + set(5, name); + set(6, password); + set(7, status); + set(8, email); + set(9, roleId); + set(10, address); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysActionLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysActionLogRecord.java new file mode 100644 index 0000000..242185e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysActionLogRecord.java @@ -0,0 +1,525 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.SysActionLogTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record12; +import org.jooq.Row12; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 系统操作日志 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysActionLogRecord extends UpdatableRecordImpl implements Record12 { + + private static final long serialVersionUID = -983085467; + + /** + * Setter for sys_action_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for sys_action_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for sys_action_log.create_time. + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for sys_action_log.create_time. + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for sys_action_log.update_time. + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for sys_action_log.update_time. + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for sys_action_log.create_by. + */ + public void setCreateBy(String value) { + set(3, value); + } + + /** + * Getter for sys_action_log.create_by. + */ + public String getCreateBy() { + return (String) get(3); + } + + /** + * Setter for sys_action_log.flag. 1正常,0删除 + */ + public void setFlag(Byte value) { + set(4, value); + } + + /** + * Getter for sys_action_log.flag. 1正常,0删除 + */ + public Byte getFlag() { + return (Byte) get(4); + } + + /** + * Setter for sys_action_log.account_id. 用户 + */ + public void setAccountId(Integer value) { + set(5, value); + } + + /** + * Getter for sys_action_log.account_id. 用户 + */ + public Integer getAccountId() { + return (Integer) get(5); + } + + /** + * Setter for sys_action_log.action. 操作名 + */ + public void setAction(String value) { + set(6, value); + } + + /** + * Getter for sys_action_log.action. 操作名 + */ + public String getAction() { + return (String) get(6); + } + + /** + * Setter for sys_action_log.action_uri. + */ + public void setActionUri(String value) { + set(7, value); + } + + /** + * Getter for sys_action_log.action_uri. + */ + public String getActionUri() { + return (String) get(7); + } + + /** + * Setter for sys_action_log.action_params. 参数 + */ + public void setActionParams(String value) { + set(8, value); + } + + /** + * Getter for sys_action_log.action_params. 参数 + */ + public String getActionParams() { + return (String) get(8); + } + + /** + * Setter for sys_action_log.action_time. + */ + public void setActionTime(Timestamp value) { + set(9, value); + } + + /** + * Getter for sys_action_log.action_time. + */ + public Timestamp getActionTime() { + return (Timestamp) get(9); + } + + /** + * Setter for sys_action_log.user_agent. + */ + public void setUserAgent(String value) { + set(10, value); + } + + /** + * Getter for sys_action_log.user_agent. + */ + public String getUserAgent() { + return (String) get(10); + } + + /** + * Setter for sys_action_log.ip. + */ + public void setIp(String value) { + set(11, value); + } + + /** + * Getter for sys_action_log.ip. + */ + public String getIp() { + return (String) get(11); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record12 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } + + @Override + public Row12 valuesRow() { + return (Row12) super.valuesRow(); + } + + @Override + public Field field1() { + return SysActionLogTable.SYS_ACTION_LOG.ID; + } + + @Override + public Field field2() { + return SysActionLogTable.SYS_ACTION_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return SysActionLogTable.SYS_ACTION_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return SysActionLogTable.SYS_ACTION_LOG.CREATE_BY; + } + + @Override + public Field field5() { + return SysActionLogTable.SYS_ACTION_LOG.FLAG; + } + + @Override + public Field field6() { + return SysActionLogTable.SYS_ACTION_LOG.ACCOUNT_ID; + } + + @Override + public Field field7() { + return SysActionLogTable.SYS_ACTION_LOG.ACTION; + } + + @Override + public Field field8() { + return SysActionLogTable.SYS_ACTION_LOG.ACTION_URI; + } + + @Override + public Field field9() { + return SysActionLogTable.SYS_ACTION_LOG.ACTION_PARAMS; + } + + @Override + public Field field10() { + return SysActionLogTable.SYS_ACTION_LOG.ACTION_TIME; + } + + @Override + public Field field11() { + return SysActionLogTable.SYS_ACTION_LOG.USER_AGENT; + } + + @Override + public Field field12() { + return SysActionLogTable.SYS_ACTION_LOG.IP; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public String component4() { + return getCreateBy(); + } + + @Override + public Byte component5() { + return getFlag(); + } + + @Override + public Integer component6() { + return getAccountId(); + } + + @Override + public String component7() { + return getAction(); + } + + @Override + public String component8() { + return getActionUri(); + } + + @Override + public String component9() { + return getActionParams(); + } + + @Override + public Timestamp component10() { + return getActionTime(); + } + + @Override + public String component11() { + return getUserAgent(); + } + + @Override + public String component12() { + return getIp(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public String value4() { + return getCreateBy(); + } + + @Override + public Byte value5() { + return getFlag(); + } + + @Override + public Integer value6() { + return getAccountId(); + } + + @Override + public String value7() { + return getAction(); + } + + @Override + public String value8() { + return getActionUri(); + } + + @Override + public String value9() { + return getActionParams(); + } + + @Override + public Timestamp value10() { + return getActionTime(); + } + + @Override + public String value11() { + return getUserAgent(); + } + + @Override + public String value12() { + return getIp(); + } + + @Override + public SysActionLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public SysActionLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public SysActionLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public SysActionLogRecord value4(String value) { + setCreateBy(value); + return this; + } + + @Override + public SysActionLogRecord value5(Byte value) { + setFlag(value); + return this; + } + + @Override + public SysActionLogRecord value6(Integer value) { + setAccountId(value); + return this; + } + + @Override + public SysActionLogRecord value7(String value) { + setAction(value); + return this; + } + + @Override + public SysActionLogRecord value8(String value) { + setActionUri(value); + return this; + } + + @Override + public SysActionLogRecord value9(String value) { + setActionParams(value); + return this; + } + + @Override + public SysActionLogRecord value10(Timestamp value) { + setActionTime(value); + return this; + } + + @Override + public SysActionLogRecord value11(String value) { + setUserAgent(value); + return this; + } + + @Override + public SysActionLogRecord value12(String value) { + setIp(value); + return this; + } + + @Override + public SysActionLogRecord values(Integer value1, Timestamp value2, Timestamp value3, String value4, Byte value5, Integer value6, String value7, String value8, String value9, Timestamp value10, String value11, String value12) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached SysActionLogRecord + */ + public SysActionLogRecord() { + super(SysActionLogTable.SYS_ACTION_LOG); + } + + /** + * Create a detached, initialised SysActionLogRecord + */ + public SysActionLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, String createBy, Byte flag, Integer accountId, String action, String actionUri, String actionParams, Timestamp actionTime, String userAgent, String ip) { + super(SysActionLogTable.SYS_ACTION_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, createBy); + set(4, flag); + set(5, accountId); + set(6, action); + set(7, actionUri); + set(8, actionParams); + set(9, actionTime); + set(10, userAgent); + set(11, ip); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysConfigRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysConfigRecord.java new file mode 100644 index 0000000..3a60833 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysConfigRecord.java @@ -0,0 +1,488 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.SysConfigTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record11; +import org.jooq.Row11; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 一些配置 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysConfigRecord extends UpdatableRecordImpl implements Record11 { + + private static final long serialVersionUID = 1917659823; + + /** + * Setter for sys_config.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for sys_config.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for sys_config.create_time. + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for sys_config.create_time. + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for sys_config.update_time. + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for sys_config.update_time. + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for sys_config.flag. 1正常,0删除 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for sys_config.flag. 1正常,0删除 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for sys_config.type. 分类,根据业务分组 + */ + public void setType(Byte value) { + set(4, value); + } + + /** + * Getter for sys_config.type. 分类,根据业务分组 + */ + public Byte getType() { + return (Byte) get(4); + } + + /** + * Setter for sys_config.config_key. key + */ + public void setConfigKey(String value) { + set(5, value); + } + + /** + * Getter for sys_config.config_key. key + */ + public String getConfigKey() { + return (String) get(5); + } + + /** + * Setter for sys_config.value_type. 1小数,2百分数,3字符串,4json,5整数 + */ + public void setValueType(Byte value) { + set(6, value); + } + + /** + * Getter for sys_config.value_type. 1小数,2百分数,3字符串,4json,5整数 + */ + public Byte getValueType() { + return (Byte) get(6); + } + + /** + * Setter for sys_config.value. + */ + public void setValue(String value) { + set(7, value); + } + + /** + * Getter for sys_config.value. + */ + public String getValue() { + return (String) get(7); + } + + /** + * Setter for sys_config.default_value. + */ + public void setDefaultValue(String value) { + set(8, value); + } + + /** + * Getter for sys_config.default_value. + */ + public String getDefaultValue() { + return (String) get(8); + } + + /** + * Setter for sys_config.description. + */ + public void setDescription(String value) { + set(9, value); + } + + /** + * Getter for sys_config.description. + */ + public String getDescription() { + return (String) get(9); + } + + /** + * Setter for sys_config.default_description. + */ + public void setDefaultDescription(String value) { + set(10, value); + } + + /** + * Getter for sys_config.default_description. + */ + public String getDefaultDescription() { + return (String) get(10); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record11 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row11 fieldsRow() { + return (Row11) super.fieldsRow(); + } + + @Override + public Row11 valuesRow() { + return (Row11) super.valuesRow(); + } + + @Override + public Field field1() { + return SysConfigTable.SYS_CONFIG.ID; + } + + @Override + public Field field2() { + return SysConfigTable.SYS_CONFIG.CREATE_TIME; + } + + @Override + public Field field3() { + return SysConfigTable.SYS_CONFIG.UPDATE_TIME; + } + + @Override + public Field field4() { + return SysConfigTable.SYS_CONFIG.FLAG; + } + + @Override + public Field field5() { + return SysConfigTable.SYS_CONFIG.TYPE; + } + + @Override + public Field field6() { + return SysConfigTable.SYS_CONFIG.CONFIG_KEY; + } + + @Override + public Field field7() { + return SysConfigTable.SYS_CONFIG.VALUE_TYPE; + } + + @Override + public Field field8() { + return SysConfigTable.SYS_CONFIG.VALUE; + } + + @Override + public Field field9() { + return SysConfigTable.SYS_CONFIG.DEFAULT_VALUE; + } + + @Override + public Field field10() { + return SysConfigTable.SYS_CONFIG.DESCRIPTION; + } + + @Override + public Field field11() { + return SysConfigTable.SYS_CONFIG.DEFAULT_DESCRIPTION; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Byte component5() { + return getType(); + } + + @Override + public String component6() { + return getConfigKey(); + } + + @Override + public Byte component7() { + return getValueType(); + } + + @Override + public String component8() { + return getValue(); + } + + @Override + public String component9() { + return getDefaultValue(); + } + + @Override + public String component10() { + return getDescription(); + } + + @Override + public String component11() { + return getDefaultDescription(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Byte value5() { + return getType(); + } + + @Override + public String value6() { + return getConfigKey(); + } + + @Override + public Byte value7() { + return getValueType(); + } + + @Override + public String value8() { + return getValue(); + } + + @Override + public String value9() { + return getDefaultValue(); + } + + @Override + public String value10() { + return getDescription(); + } + + @Override + public String value11() { + return getDefaultDescription(); + } + + @Override + public SysConfigRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public SysConfigRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public SysConfigRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public SysConfigRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public SysConfigRecord value5(Byte value) { + setType(value); + return this; + } + + @Override + public SysConfigRecord value6(String value) { + setConfigKey(value); + return this; + } + + @Override + public SysConfigRecord value7(Byte value) { + setValueType(value); + return this; + } + + @Override + public SysConfigRecord value8(String value) { + setValue(value); + return this; + } + + @Override + public SysConfigRecord value9(String value) { + setDefaultValue(value); + return this; + } + + @Override + public SysConfigRecord value10(String value) { + setDescription(value); + return this; + } + + @Override + public SysConfigRecord value11(String value) { + setDefaultDescription(value); + return this; + } + + @Override + public SysConfigRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Byte value5, String value6, Byte value7, String value8, String value9, String value10, String value11) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached SysConfigRecord + */ + public SysConfigRecord() { + super(SysConfigTable.SYS_CONFIG); + } + + /** + * Create a detached, initialised SysConfigRecord + */ + public SysConfigRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Byte type, String configKey, Byte valueType, String value, String defaultValue, String description, String defaultDescription) { + super(SysConfigTable.SYS_CONFIG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, type); + set(5, configKey); + set(6, valueType); + set(7, value); + set(8, defaultValue); + set(9, description); + set(10, defaultDescription); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysMenuRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysMenuRecord.java new file mode 100644 index 0000000..d598a3c --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysMenuRecord.java @@ -0,0 +1,673 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.SysMenuTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record16; +import org.jooq.Row16; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 菜单权限表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysMenuRecord extends UpdatableRecordImpl implements Record16 { + + private static final long serialVersionUID = 8378848; + + /** + * Setter for sys_menu.menu_id. 菜单ID + */ + public void setMenuId(Long value) { + set(0, value); + } + + /** + * Getter for sys_menu.menu_id. 菜单ID + */ + public Long getMenuId() { + return (Long) get(0); + } + + /** + * Setter for sys_menu.menu_name. 菜单名称 + */ + public void setMenuName(String value) { + set(1, value); + } + + /** + * Getter for sys_menu.menu_name. 菜单名称 + */ + public String getMenuName() { + return (String) get(1); + } + + /** + * Setter for sys_menu.parent_id. 父菜单ID + */ + public void setParentId(Long value) { + set(2, value); + } + + /** + * Getter for sys_menu.parent_id. 父菜单ID + */ + public Long getParentId() { + return (Long) get(2); + } + + /** + * Setter for sys_menu.order_num. 显示顺序 + */ + public void setOrderNum(Integer value) { + set(3, value); + } + + /** + * Getter for sys_menu.order_num. 显示顺序 + */ + public Integer getOrderNum() { + return (Integer) get(3); + } + + /** + * Setter for sys_menu.url. 请求地址 + */ + public void setUrl(String value) { + set(4, value); + } + + /** + * Getter for sys_menu.url. 请求地址 + */ + public String getUrl() { + return (String) get(4); + } + + /** + * Setter for sys_menu.target. 打开方式(menuItem页签 menuBlank新窗口) + */ + public void setTarget(String value) { + set(5, value); + } + + /** + * Getter for sys_menu.target. 打开方式(menuItem页签 menuBlank新窗口) + */ + public String getTarget() { + return (String) get(5); + } + + /** + * Setter for sys_menu.menu_type. 菜单类型(M目录 C菜单 F按钮) + */ + public void setMenuType(String value) { + set(6, value); + } + + /** + * Getter for sys_menu.menu_type. 菜单类型(M目录 C菜单 F按钮) + */ + public String getMenuType() { + return (String) get(6); + } + + /** + * Setter for sys_menu.visible. 菜单状态(0显示 1隐藏) + */ + public void setVisible(String value) { + set(7, value); + } + + /** + * Getter for sys_menu.visible. 菜单状态(0显示 1隐藏) + */ + public String getVisible() { + return (String) get(7); + } + + /** + * Setter for sys_menu.is_refresh. 是否刷新(0刷新 1不刷新) + */ + public void setIsRefresh(String value) { + set(8, value); + } + + /** + * Getter for sys_menu.is_refresh. 是否刷新(0刷新 1不刷新) + */ + public String getIsRefresh() { + return (String) get(8); + } + + /** + * Setter for sys_menu.perms. 权限标识 + */ + public void setPerms(String value) { + set(9, value); + } + + /** + * Getter for sys_menu.perms. 权限标识 + */ + public String getPerms() { + return (String) get(9); + } + + /** + * Setter for sys_menu.icon. 菜单图标 + */ + public void setIcon(String value) { + set(10, value); + } + + /** + * Getter for sys_menu.icon. 菜单图标 + */ + public String getIcon() { + return (String) get(10); + } + + /** + * Setter for sys_menu.create_by. 创建者 + */ + public void setCreateBy(String value) { + set(11, value); + } + + /** + * Getter for sys_menu.create_by. 创建者 + */ + public String getCreateBy() { + return (String) get(11); + } + + /** + * Setter for sys_menu.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(12, value); + } + + /** + * Getter for sys_menu.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(12); + } + + /** + * Setter for sys_menu.update_by. 更新者 + */ + public void setUpdateBy(String value) { + set(13, value); + } + + /** + * Getter for sys_menu.update_by. 更新者 + */ + public String getUpdateBy() { + return (String) get(13); + } + + /** + * Setter for sys_menu.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(14, value); + } + + /** + * Getter for sys_menu.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(14); + } + + /** + * Setter for sys_menu.remark. 备注 + */ + public void setRemark(String value) { + set(15, value); + } + + /** + * Getter for sys_menu.remark. 备注 + */ + public String getRemark() { + return (String) get(15); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record16 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row16 fieldsRow() { + return (Row16) super.fieldsRow(); + } + + @Override + public Row16 valuesRow() { + return (Row16) super.valuesRow(); + } + + @Override + public Field field1() { + return SysMenuTable.SYS_MENU.MENU_ID; + } + + @Override + public Field field2() { + return SysMenuTable.SYS_MENU.MENU_NAME; + } + + @Override + public Field field3() { + return SysMenuTable.SYS_MENU.PARENT_ID; + } + + @Override + public Field field4() { + return SysMenuTable.SYS_MENU.ORDER_NUM; + } + + @Override + public Field field5() { + return SysMenuTable.SYS_MENU.URL; + } + + @Override + public Field field6() { + return SysMenuTable.SYS_MENU.TARGET; + } + + @Override + public Field field7() { + return SysMenuTable.SYS_MENU.MENU_TYPE; + } + + @Override + public Field field8() { + return SysMenuTable.SYS_MENU.VISIBLE; + } + + @Override + public Field field9() { + return SysMenuTable.SYS_MENU.IS_REFRESH; + } + + @Override + public Field field10() { + return SysMenuTable.SYS_MENU.PERMS; + } + + @Override + public Field field11() { + return SysMenuTable.SYS_MENU.ICON; + } + + @Override + public Field field12() { + return SysMenuTable.SYS_MENU.CREATE_BY; + } + + @Override + public Field field13() { + return SysMenuTable.SYS_MENU.CREATE_TIME; + } + + @Override + public Field field14() { + return SysMenuTable.SYS_MENU.UPDATE_BY; + } + + @Override + public Field field15() { + return SysMenuTable.SYS_MENU.UPDATE_TIME; + } + + @Override + public Field field16() { + return SysMenuTable.SYS_MENU.REMARK; + } + + @Override + public Long component1() { + return getMenuId(); + } + + @Override + public String component2() { + return getMenuName(); + } + + @Override + public Long component3() { + return getParentId(); + } + + @Override + public Integer component4() { + return getOrderNum(); + } + + @Override + public String component5() { + return getUrl(); + } + + @Override + public String component6() { + return getTarget(); + } + + @Override + public String component7() { + return getMenuType(); + } + + @Override + public String component8() { + return getVisible(); + } + + @Override + public String component9() { + return getIsRefresh(); + } + + @Override + public String component10() { + return getPerms(); + } + + @Override + public String component11() { + return getIcon(); + } + + @Override + public String component12() { + return getCreateBy(); + } + + @Override + public Timestamp component13() { + return getCreateTime(); + } + + @Override + public String component14() { + return getUpdateBy(); + } + + @Override + public Timestamp component15() { + return getUpdateTime(); + } + + @Override + public String component16() { + return getRemark(); + } + + @Override + public Long value1() { + return getMenuId(); + } + + @Override + public String value2() { + return getMenuName(); + } + + @Override + public Long value3() { + return getParentId(); + } + + @Override + public Integer value4() { + return getOrderNum(); + } + + @Override + public String value5() { + return getUrl(); + } + + @Override + public String value6() { + return getTarget(); + } + + @Override + public String value7() { + return getMenuType(); + } + + @Override + public String value8() { + return getVisible(); + } + + @Override + public String value9() { + return getIsRefresh(); + } + + @Override + public String value10() { + return getPerms(); + } + + @Override + public String value11() { + return getIcon(); + } + + @Override + public String value12() { + return getCreateBy(); + } + + @Override + public Timestamp value13() { + return getCreateTime(); + } + + @Override + public String value14() { + return getUpdateBy(); + } + + @Override + public Timestamp value15() { + return getUpdateTime(); + } + + @Override + public String value16() { + return getRemark(); + } + + @Override + public SysMenuRecord value1(Long value) { + setMenuId(value); + return this; + } + + @Override + public SysMenuRecord value2(String value) { + setMenuName(value); + return this; + } + + @Override + public SysMenuRecord value3(Long value) { + setParentId(value); + return this; + } + + @Override + public SysMenuRecord value4(Integer value) { + setOrderNum(value); + return this; + } + + @Override + public SysMenuRecord value5(String value) { + setUrl(value); + return this; + } + + @Override + public SysMenuRecord value6(String value) { + setTarget(value); + return this; + } + + @Override + public SysMenuRecord value7(String value) { + setMenuType(value); + return this; + } + + @Override + public SysMenuRecord value8(String value) { + setVisible(value); + return this; + } + + @Override + public SysMenuRecord value9(String value) { + setIsRefresh(value); + return this; + } + + @Override + public SysMenuRecord value10(String value) { + setPerms(value); + return this; + } + + @Override + public SysMenuRecord value11(String value) { + setIcon(value); + return this; + } + + @Override + public SysMenuRecord value12(String value) { + setCreateBy(value); + return this; + } + + @Override + public SysMenuRecord value13(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public SysMenuRecord value14(String value) { + setUpdateBy(value); + return this; + } + + @Override + public SysMenuRecord value15(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public SysMenuRecord value16(String value) { + setRemark(value); + return this; + } + + @Override + public SysMenuRecord values(Long value1, String value2, Long value3, Integer value4, String value5, String value6, String value7, String value8, String value9, String value10, String value11, String value12, Timestamp value13, String value14, Timestamp value15, String value16) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + value15(value15); + value16(value16); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached SysMenuRecord + */ + public SysMenuRecord() { + super(SysMenuTable.SYS_MENU); + } + + /** + * Create a detached, initialised SysMenuRecord + */ + public SysMenuRecord(Long menuId, String menuName, Long parentId, Integer orderNum, String url, String target, String menuType, String visible, String isRefresh, String perms, String icon, String createBy, Timestamp createTime, String updateBy, Timestamp updateTime, String remark) { + super(SysMenuTable.SYS_MENU); + + set(0, menuId); + set(1, menuName); + set(2, parentId); + set(3, orderNum); + set(4, url); + set(5, target); + set(6, menuType); + set(7, visible); + set(8, isRefresh); + set(9, perms); + set(10, icon); + set(11, createBy); + set(12, createTime); + set(13, updateBy); + set(14, updateTime); + set(15, remark); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysRoleRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysRoleRecord.java new file mode 100644 index 0000000..1a10067 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/SysRoleRecord.java @@ -0,0 +1,525 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.SysRoleTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record12; +import org.jooq.Row12; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 角色信息表 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class SysRoleRecord extends UpdatableRecordImpl implements Record12 { + + private static final long serialVersionUID = -368319676; + + /** + * Setter for sys_role.role_id. 角色ID + */ + public void setRoleId(Long value) { + set(0, value); + } + + /** + * Getter for sys_role.role_id. 角色ID + */ + public Long getRoleId() { + return (Long) get(0); + } + + /** + * Setter for sys_role.role_name. 角色名称 + */ + public void setRoleName(String value) { + set(1, value); + } + + /** + * Getter for sys_role.role_name. 角色名称 + */ + public String getRoleName() { + return (String) get(1); + } + + /** + * Setter for sys_role.role_key. 角色权限字符串 + */ + public void setRoleKey(String value) { + set(2, value); + } + + /** + * Getter for sys_role.role_key. 角色权限字符串 + */ + public String getRoleKey() { + return (String) get(2); + } + + /** + * Setter for sys_role.role_sort. 显示顺序 + */ + public void setRoleSort(Integer value) { + set(3, value); + } + + /** + * Getter for sys_role.role_sort. 显示顺序 + */ + public Integer getRoleSort() { + return (Integer) get(3); + } + + /** + * Setter for sys_role.data_scope. 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) + */ + public void setDataScope(String value) { + set(4, value); + } + + /** + * Getter for sys_role.data_scope. 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) + */ + public String getDataScope() { + return (String) get(4); + } + + /** + * Setter for sys_role.status. 角色状态(0正常 1停用) + */ + public void setStatus(String value) { + set(5, value); + } + + /** + * Getter for sys_role.status. 角色状态(0正常 1停用) + */ + public String getStatus() { + return (String) get(5); + } + + /** + * Setter for sys_role.del_flag. 删除标志(0代表存在 2代表删除) + */ + public void setDelFlag(String value) { + set(6, value); + } + + /** + * Getter for sys_role.del_flag. 删除标志(0代表存在 2代表删除) + */ + public String getDelFlag() { + return (String) get(6); + } + + /** + * Setter for sys_role.create_by. 创建者 + */ + public void setCreateBy(String value) { + set(7, value); + } + + /** + * Getter for sys_role.create_by. 创建者 + */ + public String getCreateBy() { + return (String) get(7); + } + + /** + * Setter for sys_role.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(8, value); + } + + /** + * Getter for sys_role.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(8); + } + + /** + * Setter for sys_role.update_by. 更新者 + */ + public void setUpdateBy(String value) { + set(9, value); + } + + /** + * Getter for sys_role.update_by. 更新者 + */ + public String getUpdateBy() { + return (String) get(9); + } + + /** + * Setter for sys_role.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(10, value); + } + + /** + * Getter for sys_role.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(10); + } + + /** + * Setter for sys_role.remark. 备注 + */ + public void setRemark(String value) { + set(11, value); + } + + /** + * Getter for sys_role.remark. 备注 + */ + public String getRemark() { + return (String) get(11); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record12 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); + } + + @Override + public Row12 valuesRow() { + return (Row12) super.valuesRow(); + } + + @Override + public Field field1() { + return SysRoleTable.SYS_ROLE.ROLE_ID; + } + + @Override + public Field field2() { + return SysRoleTable.SYS_ROLE.ROLE_NAME; + } + + @Override + public Field field3() { + return SysRoleTable.SYS_ROLE.ROLE_KEY; + } + + @Override + public Field field4() { + return SysRoleTable.SYS_ROLE.ROLE_SORT; + } + + @Override + public Field field5() { + return SysRoleTable.SYS_ROLE.DATA_SCOPE; + } + + @Override + public Field field6() { + return SysRoleTable.SYS_ROLE.STATUS; + } + + @Override + public Field field7() { + return SysRoleTable.SYS_ROLE.DEL_FLAG; + } + + @Override + public Field field8() { + return SysRoleTable.SYS_ROLE.CREATE_BY; + } + + @Override + public Field field9() { + return SysRoleTable.SYS_ROLE.CREATE_TIME; + } + + @Override + public Field field10() { + return SysRoleTable.SYS_ROLE.UPDATE_BY; + } + + @Override + public Field field11() { + return SysRoleTable.SYS_ROLE.UPDATE_TIME; + } + + @Override + public Field field12() { + return SysRoleTable.SYS_ROLE.REMARK; + } + + @Override + public Long component1() { + return getRoleId(); + } + + @Override + public String component2() { + return getRoleName(); + } + + @Override + public String component3() { + return getRoleKey(); + } + + @Override + public Integer component4() { + return getRoleSort(); + } + + @Override + public String component5() { + return getDataScope(); + } + + @Override + public String component6() { + return getStatus(); + } + + @Override + public String component7() { + return getDelFlag(); + } + + @Override + public String component8() { + return getCreateBy(); + } + + @Override + public Timestamp component9() { + return getCreateTime(); + } + + @Override + public String component10() { + return getUpdateBy(); + } + + @Override + public Timestamp component11() { + return getUpdateTime(); + } + + @Override + public String component12() { + return getRemark(); + } + + @Override + public Long value1() { + return getRoleId(); + } + + @Override + public String value2() { + return getRoleName(); + } + + @Override + public String value3() { + return getRoleKey(); + } + + @Override + public Integer value4() { + return getRoleSort(); + } + + @Override + public String value5() { + return getDataScope(); + } + + @Override + public String value6() { + return getStatus(); + } + + @Override + public String value7() { + return getDelFlag(); + } + + @Override + public String value8() { + return getCreateBy(); + } + + @Override + public Timestamp value9() { + return getCreateTime(); + } + + @Override + public String value10() { + return getUpdateBy(); + } + + @Override + public Timestamp value11() { + return getUpdateTime(); + } + + @Override + public String value12() { + return getRemark(); + } + + @Override + public SysRoleRecord value1(Long value) { + setRoleId(value); + return this; + } + + @Override + public SysRoleRecord value2(String value) { + setRoleName(value); + return this; + } + + @Override + public SysRoleRecord value3(String value) { + setRoleKey(value); + return this; + } + + @Override + public SysRoleRecord value4(Integer value) { + setRoleSort(value); + return this; + } + + @Override + public SysRoleRecord value5(String value) { + setDataScope(value); + return this; + } + + @Override + public SysRoleRecord value6(String value) { + setStatus(value); + return this; + } + + @Override + public SysRoleRecord value7(String value) { + setDelFlag(value); + return this; + } + + @Override + public SysRoleRecord value8(String value) { + setCreateBy(value); + return this; + } + + @Override + public SysRoleRecord value9(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public SysRoleRecord value10(String value) { + setUpdateBy(value); + return this; + } + + @Override + public SysRoleRecord value11(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public SysRoleRecord value12(String value) { + setRemark(value); + return this; + } + + @Override + public SysRoleRecord values(Long value1, String value2, String value3, Integer value4, String value5, String value6, String value7, String value8, Timestamp value9, String value10, Timestamp value11, String value12) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached SysRoleRecord + */ + public SysRoleRecord() { + super(SysRoleTable.SYS_ROLE); + } + + /** + * Create a detached, initialised SysRoleRecord + */ + public SysRoleRecord(Long roleId, String roleName, String roleKey, Integer roleSort, String dataScope, String status, String delFlag, String createBy, Timestamp createTime, String updateBy, Timestamp updateTime, String remark) { + super(SysRoleTable.SYS_ROLE); + + set(0, roleId); + set(1, roleName); + set(2, roleKey); + set(3, roleSort); + set(4, dataScope); + set(5, status); + set(6, delFlag); + set(7, createBy); + set(8, createTime); + set(9, updateBy); + set(10, updateTime); + set(11, remark); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberRecord.java new file mode 100644 index 0000000..d9e2f23 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberRecord.java @@ -0,0 +1,455 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TMemberTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 用户 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberRecord extends UpdatableRecordImpl { + + private static final long serialVersionUID = -614468327; + + /** + * Setter for t_member.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_member.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_member.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_member.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_member.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_member.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_member.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_member.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_member.account. 账号 + */ + public void setAccount(String value) { + set(4, value); + } + + /** + * Getter for t_member.account. 账号 + */ + public String getAccount() { + return (String) get(4); + } + + /** + * Setter for t_member.account_type. 账号类型,1地址,2邮箱 + */ + public void setAccountType(Integer value) { + set(5, value); + } + + /** + * Getter for t_member.account_type. 账号类型,1地址,2邮箱 + */ + public Integer getAccountType() { + return (Integer) get(5); + } + + /** + * Setter for t_member.refer_id. 推荐人ID + */ + public void setReferId(Integer value) { + set(6, value); + } + + /** + * Getter for t_member.refer_id. 推荐人ID + */ + public Integer getReferId() { + return (Integer) get(6); + } + + /** + * Setter for t_member.all_pid. 上面的人 + */ + public void setAllPid(String value) { + set(7, value); + } + + /** + * Getter for t_member.all_pid. 上面的人 + */ + public String getAllPid() { + return (String) get(7); + } + + /** + * Setter for t_member.password_login. 登录密码 + */ + public void setPasswordLogin(String value) { + set(8, value); + } + + /** + * Getter for t_member.password_login. 登录密码 + */ + public String getPasswordLogin() { + return (String) get(8); + } + + /** + * Setter for t_member.password_pay. 支付密码 + */ + public void setPasswordPay(String value) { + set(9, value); + } + + /** + * Getter for t_member.password_pay. 支付密码 + */ + public String getPasswordPay() { + return (String) get(9); + } + + /** + * Setter for t_member.share_code. 邀请码 + */ + public void setShareCode(String value) { + set(10, value); + } + + /** + * Getter for t_member.share_code. 邀请码 + */ + public String getShareCode() { + return (String) get(10); + } + + /** + * Setter for t_member.uid. 8位UID + */ + public void setUid(String value) { + set(11, value); + } + + /** + * Getter for t_member.uid. 8位UID + */ + public String getUid() { + return (String) get(11); + } + + /** + * Setter for t_member.level. 等级,看代码 + */ + public void setLevel(Integer value) { + set(12, value); + } + + /** + * Getter for t_member.level. 等级,看代码 + */ + public Integer getLevel() { + return (Integer) get(12); + } + + /** + * Setter for t_member.min_level. 后台设置的等级 + */ + public void setMinLevel(Integer value) { + set(13, value); + } + + /** + * Getter for t_member.min_level. 后台设置的等级 + */ + public Integer getMinLevel() { + return (Integer) get(13); + } + + /** + * Setter for t_member.share_num. 直推人数 + */ + public void setShareNum(Integer value) { + set(14, value); + } + + /** + * Getter for t_member.share_num. 直推人数 + */ + public Integer getShareNum() { + return (Integer) get(14); + } + + /** + * Setter for t_member.team_num. 团队人数,含自己 + */ + public void setTeamNum(Integer value) { + set(15, value); + } + + /** + * Getter for t_member.team_num. 团队人数,含自己 + */ + public Integer getTeamNum() { + return (Integer) get(15); + } + + /** + * Setter for t_member.chain_type. 链类型:1=Bitcoin2= +Ethereum3= +Polygon4= +BNB Chain 5=Arbitrum One + */ + public void setChainType(Integer value) { + set(16, value); + } + + /** + * Getter for t_member.chain_type. 链类型:1=Bitcoin2= +Ethereum3= +Polygon4= +BNB Chain 5=Arbitrum One + */ + public Integer getChainType() { + return (Integer) get(16); + } + + /** + * Setter for t_member.code_prompt. 是否提示绑定邀请码 0=未提示 1=已提示 + */ + public void setCodePrompt(Integer value) { + set(17, value); + } + + /** + * Getter for t_member.code_prompt. 是否提示绑定邀请码 0=未提示 1=已提示 + */ + public Integer getCodePrompt() { + return (Integer) get(17); + } + + /** + * Setter for t_member.twitter_type. 是否更新推特 0=未更新 1=已更新 + */ + public void setTwitterType(Integer value) { + set(18, value); + } + + /** + * Getter for t_member.twitter_type. 是否更新推特 0=未更新 1=已更新 + */ + public Integer getTwitterType() { + return (Integer) get(18); + } + + /** + * Setter for t_member.twitter_id. 推特id + */ + public void setTwitterId(String value) { + set(19, value); + } + + /** + * Getter for t_member.twitter_id. 推特id + */ + public String getTwitterId() { + return (String) get(19); + } + + /** + * Setter for t_member.twitter_name. 推特账号 + */ + public void setTwitterName(String value) { + set(20, value); + } + + /** + * Getter for t_member.twitter_name. 推特账号 + */ + public String getTwitterName() { + return (String) get(20); + } + + /** + * Setter for t_member.twitter_img. 用户头像 + */ + public void setTwitterImg(String value) { + set(21, value); + } + + /** + * Getter for t_member.twitter_img. 用户头像 + */ + public String getTwitterImg() { + return (String) get(21); + } + + /** + * Setter for t_member.twitter_user_name. 用户名称 + */ + public void setTwitterUserName(String value) { + set(22, value); + } + + /** + * Getter for t_member.twitter_user_name. 用户名称 + */ + public String getTwitterUserName() { + return (String) get(22); + } + + /** + * Setter for t_member.discord_id. 用户DiscordID + */ + public void setDiscordId(String value) { + set(23, value); + } + + /** + * Getter for t_member.discord_id. 用户DiscordID + */ + public String getDiscordId() { + return (String) get(23); + } + + /** + * Setter for t_member.tg_id. 用户TG ID + */ + public void setTgId(String value) { + set(24, value); + } + + /** + * Getter for t_member.tg_id. 用户TG ID + */ + public String getTgId() { + return (String) get(24); + } + + /** + * Setter for t_member.top_user. 特定顶级用户 1=是 0=普通用户 + */ + public void setTopUser(Integer value) { + set(25, value); + } + + /** + * Getter for t_member.top_user. 特定顶级用户 1=是 0=普通用户 + */ + public Integer getTopUser() { + return (Integer) get(25); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TMemberRecord + */ + public TMemberRecord() { + super(TMemberTable.T_MEMBER); + } + + /** + * Create a detached, initialised TMemberRecord + */ + public TMemberRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String account, Integer accountType, Integer referId, String allPid, String passwordLogin, String passwordPay, String shareCode, String uid, Integer level, Integer minLevel, Integer shareNum, Integer teamNum, Integer chainType, Integer codePrompt, Integer twitterType, String twitterId, String twitterName, String twitterImg, String twitterUserName, String discordId, String tgId, Integer topUser) { + super(TMemberTable.T_MEMBER); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, account); + set(5, accountType); + set(6, referId); + set(7, allPid); + set(8, passwordLogin); + set(9, passwordPay); + set(10, shareCode); + set(11, uid); + set(12, level); + set(13, minLevel); + set(14, shareNum); + set(15, teamNum); + set(16, chainType); + set(17, codePrompt); + set(18, twitterType); + set(19, twitterId); + set(20, twitterName); + set(21, twitterImg); + set(22, twitterUserName); + set(23, discordId); + set(24, tgId); + set(25, topUser); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberSignRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberSignRecord.java new file mode 100644 index 0000000..26d6ad2 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberSignRecord.java @@ -0,0 +1,340 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TMemberSignTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record7; +import org.jooq.Row7; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 用户签名交易对 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberSignRecord extends UpdatableRecordImpl implements Record7 { + + private static final long serialVersionUID = 2115022533; + + /** + * Setter for t_member_sign.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_member_sign.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_member_sign.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_member_sign.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_member_sign.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_member_sign.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_member_sign.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_member_sign.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_member_sign.address. 账号 + */ + public void setAddress(String value) { + set(4, value); + } + + /** + * Getter for t_member_sign.address. 账号 + */ + public String getAddress() { + return (String) get(4); + } + + /** + * Setter for t_member_sign.public_key. 公钥 + */ + public void setPublicKey(String value) { + set(5, value); + } + + /** + * Getter for t_member_sign.public_key. 公钥 + */ + public String getPublicKey() { + return (String) get(5); + } + + /** + * Setter for t_member_sign.private_key. 私钥 + */ + public void setPrivateKey(String value) { + set(6, value); + } + + /** + * Getter for t_member_sign.private_key. 私钥 + */ + public String getPrivateKey() { + return (String) get(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record7 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row7 fieldsRow() { + return (Row7) super.fieldsRow(); + } + + @Override + public Row7 valuesRow() { + return (Row7) super.valuesRow(); + } + + @Override + public Field field1() { + return TMemberSignTable.T_MEMBER_SIGN.ID; + } + + @Override + public Field field2() { + return TMemberSignTable.T_MEMBER_SIGN.CREATE_TIME; + } + + @Override + public Field field3() { + return TMemberSignTable.T_MEMBER_SIGN.UPDATE_TIME; + } + + @Override + public Field field4() { + return TMemberSignTable.T_MEMBER_SIGN.FLAG; + } + + @Override + public Field field5() { + return TMemberSignTable.T_MEMBER_SIGN.ADDRESS; + } + + @Override + public Field field6() { + return TMemberSignTable.T_MEMBER_SIGN.PUBLIC_KEY; + } + + @Override + public Field field7() { + return TMemberSignTable.T_MEMBER_SIGN.PRIVATE_KEY; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getAddress(); + } + + @Override + public String component6() { + return getPublicKey(); + } + + @Override + public String component7() { + return getPrivateKey(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getAddress(); + } + + @Override + public String value6() { + return getPublicKey(); + } + + @Override + public String value7() { + return getPrivateKey(); + } + + @Override + public TMemberSignRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TMemberSignRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public TMemberSignRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public TMemberSignRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public TMemberSignRecord value5(String value) { + setAddress(value); + return this; + } + + @Override + public TMemberSignRecord value6(String value) { + setPublicKey(value); + return this; + } + + @Override + public TMemberSignRecord value7(String value) { + setPrivateKey(value); + return this; + } + + @Override + public TMemberSignRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, String value7) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TMemberSignRecord + */ + public TMemberSignRecord() { + super(TMemberSignTable.T_MEMBER_SIGN); + } + + /** + * Create a detached, initialised TMemberSignRecord + */ + public TMemberSignRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String address, String publicKey, String privateKey) { + super(TMemberSignTable.T_MEMBER_SIGN); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, address); + set(5, publicKey); + set(6, privateKey); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletLogRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletLogRecord.java new file mode 100644 index 0000000..e67c533 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletLogRecord.java @@ -0,0 +1,600 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TMemberWalletLogTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record14; +import org.jooq.Row14; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 资产流水 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletLogRecord extends UpdatableRecordImpl implements Record14 { + + private static final long serialVersionUID = 583305078; + + /** + * Setter for t_member_wallet_log.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_member_wallet_log.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_member_wallet_log.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_member_wallet_log.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_member_wallet_log.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_member_wallet_log.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_member_wallet_log.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_member_wallet_log.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_member_wallet_log.member_id. + */ + public void setMemberId(Integer value) { + set(4, value); + } + + /** + * Getter for t_member_wallet_log.member_id. + */ + public Integer getMemberId() { + return (Integer) get(4); + } + + /** + * Setter for t_member_wallet_log.wallet_id. + */ + public void setWalletId(Integer value) { + set(5, value); + } + + /** + * Getter for t_member_wallet_log.wallet_id. + */ + public Integer getWalletId() { + return (Integer) get(5); + } + + /** + * Setter for t_member_wallet_log.type. 1余额,2冻结 + */ + public void setType(Integer value) { + set(6, value); + } + + /** + * Getter for t_member_wallet_log.type. 1余额,2冻结 + */ + public Integer getType() { + return (Integer) get(6); + } + + /** + * Setter for t_member_wallet_log.coin_id. 币种id + */ + public void setCoinId(Integer value) { + set(7, value); + } + + /** + * Getter for t_member_wallet_log.coin_id. 币种id + */ + public Integer getCoinId() { + return (Integer) get(7); + } + + /** + * Setter for t_member_wallet_log.op_type. + */ + public void setOpType(Integer value) { + set(8, value); + } + + /** + * Getter for t_member_wallet_log.op_type. + */ + public Integer getOpType() { + return (Integer) get(8); + } + + /** + * Setter for t_member_wallet_log.op_remark. 流水类型 + */ + public void setOpRemark(String value) { + set(9, value); + } + + /** + * Getter for t_member_wallet_log.op_remark. 流水类型 + */ + public String getOpRemark() { + return (String) get(9); + } + + /** + * Setter for t_member_wallet_log.op_value. + */ + public void setOpValue(BigDecimal value) { + set(10, value); + } + + /** + * Getter for t_member_wallet_log.op_value. + */ + public BigDecimal getOpValue() { + return (BigDecimal) get(10); + } + + /** + * Setter for t_member_wallet_log.op_before. + */ + public void setOpBefore(BigDecimal value) { + set(11, value); + } + + /** + * Getter for t_member_wallet_log.op_before. + */ + public BigDecimal getOpBefore() { + return (BigDecimal) get(11); + } + + /** + * Setter for t_member_wallet_log.op_after. + */ + public void setOpAfter(BigDecimal value) { + set(12, value); + } + + /** + * Getter for t_member_wallet_log.op_after. + */ + public BigDecimal getOpAfter() { + return (BigDecimal) get(12); + } + + /** + * Setter for t_member_wallet_log.ext_remark. 额外的备注 + */ + public void setExtRemark(String value) { + set(13, value); + } + + /** + * Getter for t_member_wallet_log.ext_remark. 额外的备注 + */ + public String getExtRemark() { + return (String) get(13); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record14 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row14 fieldsRow() { + return (Row14) super.fieldsRow(); + } + + @Override + public Row14 valuesRow() { + return (Row14) super.valuesRow(); + } + + @Override + public Field field1() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.ID; + } + + @Override + public Field field2() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.CREATE_TIME; + } + + @Override + public Field field3() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.UPDATE_TIME; + } + + @Override + public Field field4() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.FLAG; + } + + @Override + public Field field5() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.MEMBER_ID; + } + + @Override + public Field field6() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.WALLET_ID; + } + + @Override + public Field field7() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.TYPE; + } + + @Override + public Field field8() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.COIN_ID; + } + + @Override + public Field field9() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.OP_TYPE; + } + + @Override + public Field field10() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.OP_REMARK; + } + + @Override + public Field field11() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.OP_VALUE; + } + + @Override + public Field field12() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.OP_BEFORE; + } + + @Override + public Field field13() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.OP_AFTER; + } + + @Override + public Field field14() { + return TMemberWalletLogTable.T_MEMBER_WALLET_LOG.EXT_REMARK; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getMemberId(); + } + + @Override + public Integer component6() { + return getWalletId(); + } + + @Override + public Integer component7() { + return getType(); + } + + @Override + public Integer component8() { + return getCoinId(); + } + + @Override + public Integer component9() { + return getOpType(); + } + + @Override + public String component10() { + return getOpRemark(); + } + + @Override + public BigDecimal component11() { + return getOpValue(); + } + + @Override + public BigDecimal component12() { + return getOpBefore(); + } + + @Override + public BigDecimal component13() { + return getOpAfter(); + } + + @Override + public String component14() { + return getExtRemark(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getMemberId(); + } + + @Override + public Integer value6() { + return getWalletId(); + } + + @Override + public Integer value7() { + return getType(); + } + + @Override + public Integer value8() { + return getCoinId(); + } + + @Override + public Integer value9() { + return getOpType(); + } + + @Override + public String value10() { + return getOpRemark(); + } + + @Override + public BigDecimal value11() { + return getOpValue(); + } + + @Override + public BigDecimal value12() { + return getOpBefore(); + } + + @Override + public BigDecimal value13() { + return getOpAfter(); + } + + @Override + public String value14() { + return getExtRemark(); + } + + @Override + public TMemberWalletLogRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TMemberWalletLogRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public TMemberWalletLogRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public TMemberWalletLogRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public TMemberWalletLogRecord value5(Integer value) { + setMemberId(value); + return this; + } + + @Override + public TMemberWalletLogRecord value6(Integer value) { + setWalletId(value); + return this; + } + + @Override + public TMemberWalletLogRecord value7(Integer value) { + setType(value); + return this; + } + + @Override + public TMemberWalletLogRecord value8(Integer value) { + setCoinId(value); + return this; + } + + @Override + public TMemberWalletLogRecord value9(Integer value) { + setOpType(value); + return this; + } + + @Override + public TMemberWalletLogRecord value10(String value) { + setOpRemark(value); + return this; + } + + @Override + public TMemberWalletLogRecord value11(BigDecimal value) { + setOpValue(value); + return this; + } + + @Override + public TMemberWalletLogRecord value12(BigDecimal value) { + setOpBefore(value); + return this; + } + + @Override + public TMemberWalletLogRecord value13(BigDecimal value) { + setOpAfter(value); + return this; + } + + @Override + public TMemberWalletLogRecord value14(String value) { + setExtRemark(value); + return this; + } + + @Override + public TMemberWalletLogRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, Integer value6, Integer value7, Integer value8, Integer value9, String value10, BigDecimal value11, BigDecimal value12, BigDecimal value13, String value14) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + value10(value10); + value11(value11); + value12(value12); + value13(value13); + value14(value14); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TMemberWalletLogRecord + */ + public TMemberWalletLogRecord() { + super(TMemberWalletLogTable.T_MEMBER_WALLET_LOG); + } + + /** + * Create a detached, initialised TMemberWalletLogRecord + */ + public TMemberWalletLogRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer memberId, Integer walletId, Integer type, Integer coinId, Integer opType, String opRemark, BigDecimal opValue, BigDecimal opBefore, BigDecimal opAfter, String extRemark) { + super(TMemberWalletLogTable.T_MEMBER_WALLET_LOG); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, memberId); + set(5, walletId); + set(6, type); + set(7, coinId); + set(8, opType); + set(9, opRemark); + set(10, opValue); + set(11, opBefore); + set(12, opAfter); + set(13, extRemark); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletRecord.java new file mode 100644 index 0000000..86d86ed --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TMemberWalletRecord.java @@ -0,0 +1,378 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TMemberWalletTable; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record8; +import org.jooq.Row8; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 资产 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TMemberWalletRecord extends UpdatableRecordImpl implements Record8 { + + private static final long serialVersionUID = -1665053581; + + /** + * Setter for t_member_wallet.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_member_wallet.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_member_wallet.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_member_wallet.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_member_wallet.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_member_wallet.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_member_wallet.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_member_wallet.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_member_wallet.member_id. + */ + public void setMemberId(Integer value) { + set(4, value); + } + + /** + * Getter for t_member_wallet.member_id. + */ + public Integer getMemberId() { + return (Integer) get(4); + } + + /** + * Setter for t_member_wallet.coin_id. 币种id + */ + public void setCoinId(Integer value) { + set(5, value); + } + + /** + * Getter for t_member_wallet.coin_id. 币种id + */ + public Integer getCoinId() { + return (Integer) get(5); + } + + /** + * Setter for t_member_wallet.balance. 余额 + */ + public void setBalance(BigDecimal value) { + set(6, value); + } + + /** + * Getter for t_member_wallet.balance. 余额 + */ + public BigDecimal getBalance() { + return (BigDecimal) get(6); + } + + /** + * Setter for t_member_wallet.frozen. 冻结,余额的一部分 + */ + public void setFrozen(BigDecimal value) { + set(7, value); + } + + /** + * Getter for t_member_wallet.frozen. 冻结,余额的一部分 + */ + public BigDecimal getFrozen() { + return (BigDecimal) get(7); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record8 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row8 fieldsRow() { + return (Row8) super.fieldsRow(); + } + + @Override + public Row8 valuesRow() { + return (Row8) super.valuesRow(); + } + + @Override + public Field field1() { + return TMemberWalletTable.T_MEMBER_WALLET.ID; + } + + @Override + public Field field2() { + return TMemberWalletTable.T_MEMBER_WALLET.CREATE_TIME; + } + + @Override + public Field field3() { + return TMemberWalletTable.T_MEMBER_WALLET.UPDATE_TIME; + } + + @Override + public Field field4() { + return TMemberWalletTable.T_MEMBER_WALLET.FLAG; + } + + @Override + public Field field5() { + return TMemberWalletTable.T_MEMBER_WALLET.MEMBER_ID; + } + + @Override + public Field field6() { + return TMemberWalletTable.T_MEMBER_WALLET.COIN_ID; + } + + @Override + public Field field7() { + return TMemberWalletTable.T_MEMBER_WALLET.BALANCE; + } + + @Override + public Field field8() { + return TMemberWalletTable.T_MEMBER_WALLET.FROZEN; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public Integer component5() { + return getMemberId(); + } + + @Override + public Integer component6() { + return getCoinId(); + } + + @Override + public BigDecimal component7() { + return getBalance(); + } + + @Override + public BigDecimal component8() { + return getFrozen(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public Integer value5() { + return getMemberId(); + } + + @Override + public Integer value6() { + return getCoinId(); + } + + @Override + public BigDecimal value7() { + return getBalance(); + } + + @Override + public BigDecimal value8() { + return getFrozen(); + } + + @Override + public TMemberWalletRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TMemberWalletRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public TMemberWalletRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public TMemberWalletRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public TMemberWalletRecord value5(Integer value) { + setMemberId(value); + return this; + } + + @Override + public TMemberWalletRecord value6(Integer value) { + setCoinId(value); + return this; + } + + @Override + public TMemberWalletRecord value7(BigDecimal value) { + setBalance(value); + return this; + } + + @Override + public TMemberWalletRecord value8(BigDecimal value) { + setFrozen(value); + return this; + } + + @Override + public TMemberWalletRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, Integer value5, Integer value6, BigDecimal value7, BigDecimal value8) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TMemberWalletRecord + */ + public TMemberWalletRecord() { + super(TMemberWalletTable.T_MEMBER_WALLET); + } + + /** + * Create a detached, initialised TMemberWalletRecord + */ + public TMemberWalletRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, Integer memberId, Integer coinId, BigDecimal balance, BigDecimal frozen) { + super(TMemberWalletTable.T_MEMBER_WALLET); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, memberId); + set(5, coinId); + set(6, balance); + set(7, frozen); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniBannerRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniBannerRecord.java new file mode 100644 index 0000000..9df277d --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniBannerRecord.java @@ -0,0 +1,414 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TUniBannerTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record9; +import org.jooq.Row9; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * Banner + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniBannerRecord extends UpdatableRecordImpl implements Record9 { + + private static final long serialVersionUID = -849722336; + + /** + * Setter for t_uni_banner.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_uni_banner.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_uni_banner.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_uni_banner.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_uni_banner.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_uni_banner.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_uni_banner.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_uni_banner.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_uni_banner.lang. 语言 + */ + public void setLang(String value) { + set(4, value); + } + + /** + * Getter for t_uni_banner.lang. 语言 + */ + public String getLang() { + return (String) get(4); + } + + /** + * Setter for t_uni_banner.title. 标题 + */ + public void setTitle(String value) { + set(5, value); + } + + /** + * Getter for t_uni_banner.title. 标题 + */ + public String getTitle() { + return (String) get(5); + } + + /** + * Setter for t_uni_banner.image_url. 图片链接 + */ + public void setImageUrl(String value) { + set(6, value); + } + + /** + * Getter for t_uni_banner.image_url. 图片链接 + */ + public String getImageUrl() { + return (String) get(6); + } + + /** + * Setter for t_uni_banner.state. 0隐藏,1显示 + */ + public void setState(Integer value) { + set(7, value); + } + + /** + * Getter for t_uni_banner.state. 0隐藏,1显示 + */ + public Integer getState() { + return (Integer) get(7); + } + + /** + * Setter for t_uni_banner.target_url. 跳转链接 + */ + public void setTargetUrl(String value) { + set(8, value); + } + + /** + * Getter for t_uni_banner.target_url. 跳转链接 + */ + public String getTargetUrl() { + return (String) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record9 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } + + @Override + public Row9 valuesRow() { + return (Row9) super.valuesRow(); + } + + @Override + public Field field1() { + return TUniBannerTable.T_UNI_BANNER.ID; + } + + @Override + public Field field2() { + return TUniBannerTable.T_UNI_BANNER.CREATE_TIME; + } + + @Override + public Field field3() { + return TUniBannerTable.T_UNI_BANNER.UPDATE_TIME; + } + + @Override + public Field field4() { + return TUniBannerTable.T_UNI_BANNER.FLAG; + } + + @Override + public Field field5() { + return TUniBannerTable.T_UNI_BANNER.LANG; + } + + @Override + public Field field6() { + return TUniBannerTable.T_UNI_BANNER.TITLE; + } + + @Override + public Field field7() { + return TUniBannerTable.T_UNI_BANNER.IMAGE_URL; + } + + @Override + public Field field8() { + return TUniBannerTable.T_UNI_BANNER.STATE; + } + + @Override + public Field field9() { + return TUniBannerTable.T_UNI_BANNER.TARGET_URL; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getLang(); + } + + @Override + public String component6() { + return getTitle(); + } + + @Override + public String component7() { + return getImageUrl(); + } + + @Override + public Integer component8() { + return getState(); + } + + @Override + public String component9() { + return getTargetUrl(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getLang(); + } + + @Override + public String value6() { + return getTitle(); + } + + @Override + public String value7() { + return getImageUrl(); + } + + @Override + public Integer value8() { + return getState(); + } + + @Override + public String value9() { + return getTargetUrl(); + } + + @Override + public TUniBannerRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TUniBannerRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public TUniBannerRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public TUniBannerRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public TUniBannerRecord value5(String value) { + setLang(value); + return this; + } + + @Override + public TUniBannerRecord value6(String value) { + setTitle(value); + return this; + } + + @Override + public TUniBannerRecord value7(String value) { + setImageUrl(value); + return this; + } + + @Override + public TUniBannerRecord value8(Integer value) { + setState(value); + return this; + } + + @Override + public TUniBannerRecord value9(String value) { + setTargetUrl(value); + return this; + } + + @Override + public TUniBannerRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, String value7, Integer value8, String value9) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TUniBannerRecord + */ + public TUniBannerRecord() { + super(TUniBannerTable.T_UNI_BANNER); + } + + /** + * Create a detached, initialised TUniBannerRecord + */ + public TUniBannerRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String lang, String title, String imageUrl, Integer state, String targetUrl) { + super(TUniBannerTable.T_UNI_BANNER); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, lang); + set(5, title); + set(6, imageUrl); + set(7, state); + set(8, targetUrl); + } +} diff --git a/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniNoticeRecord.java b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniNoticeRecord.java new file mode 100644 index 0000000..7cb802e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/jooq/tables/records/TUniNoticeRecord.java @@ -0,0 +1,414 @@ +/* + * This file is generated by jOOQ. + */ +package com.alive.db.jooq.tables.records; + + +import com.alive.db.jooq.tables.TUniNoticeTable; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record9; +import org.jooq.Row9; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * 公告 + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.12.3" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TUniNoticeRecord extends UpdatableRecordImpl implements Record9 { + + private static final long serialVersionUID = -2062393617; + + /** + * Setter for t_uni_notice.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for t_uni_notice.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for t_uni_notice.create_time. 创建时间 + */ + public void setCreateTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for t_uni_notice.create_time. 创建时间 + */ + public Timestamp getCreateTime() { + return (Timestamp) get(1); + } + + /** + * Setter for t_uni_notice.update_time. 更新时间 + */ + public void setUpdateTime(Timestamp value) { + set(2, value); + } + + /** + * Getter for t_uni_notice.update_time. 更新时间 + */ + public Timestamp getUpdateTime() { + return (Timestamp) get(2); + } + + /** + * Setter for t_uni_notice.flag. 标记删除,0 / 1 + */ + public void setFlag(Byte value) { + set(3, value); + } + + /** + * Getter for t_uni_notice.flag. 标记删除,0 / 1 + */ + public Byte getFlag() { + return (Byte) get(3); + } + + /** + * Setter for t_uni_notice.title. 标题 + */ + public void setTitle(String value) { + set(4, value); + } + + /** + * Getter for t_uni_notice.title. 标题 + */ + public String getTitle() { + return (String) get(4); + } + + /** + * Setter for t_uni_notice.content. 内容 + */ + public void setContent(String value) { + set(5, value); + } + + /** + * Getter for t_uni_notice.content. 内容 + */ + public String getContent() { + return (String) get(5); + } + + /** + * Setter for t_uni_notice.publish_time. 发布时间 + */ + public void setPublishTime(Timestamp value) { + set(6, value); + } + + /** + * Getter for t_uni_notice.publish_time. 发布时间 + */ + public Timestamp getPublishTime() { + return (Timestamp) get(6); + } + + /** + * Setter for t_uni_notice.state. 0草稿,1发布 + */ + public void setState(Integer value) { + set(7, value); + } + + /** + * Getter for t_uni_notice.state. 0草稿,1发布 + */ + public Integer getState() { + return (Integer) get(7); + } + + /** + * Setter for t_uni_notice.lang. 语言 + */ + public void setLang(String value) { + set(8, value); + } + + /** + * Getter for t_uni_notice.lang. 语言 + */ + public String getLang() { + return (String) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record9 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } + + @Override + public Row9 valuesRow() { + return (Row9) super.valuesRow(); + } + + @Override + public Field field1() { + return TUniNoticeTable.T_UNI_NOTICE.ID; + } + + @Override + public Field field2() { + return TUniNoticeTable.T_UNI_NOTICE.CREATE_TIME; + } + + @Override + public Field field3() { + return TUniNoticeTable.T_UNI_NOTICE.UPDATE_TIME; + } + + @Override + public Field field4() { + return TUniNoticeTable.T_UNI_NOTICE.FLAG; + } + + @Override + public Field field5() { + return TUniNoticeTable.T_UNI_NOTICE.TITLE; + } + + @Override + public Field field6() { + return TUniNoticeTable.T_UNI_NOTICE.CONTENT; + } + + @Override + public Field field7() { + return TUniNoticeTable.T_UNI_NOTICE.PUBLISH_TIME; + } + + @Override + public Field field8() { + return TUniNoticeTable.T_UNI_NOTICE.STATE; + } + + @Override + public Field field9() { + return TUniNoticeTable.T_UNI_NOTICE.LANG; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public Timestamp component2() { + return getCreateTime(); + } + + @Override + public Timestamp component3() { + return getUpdateTime(); + } + + @Override + public Byte component4() { + return getFlag(); + } + + @Override + public String component5() { + return getTitle(); + } + + @Override + public String component6() { + return getContent(); + } + + @Override + public Timestamp component7() { + return getPublishTime(); + } + + @Override + public Integer component8() { + return getState(); + } + + @Override + public String component9() { + return getLang(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public Timestamp value2() { + return getCreateTime(); + } + + @Override + public Timestamp value3() { + return getUpdateTime(); + } + + @Override + public Byte value4() { + return getFlag(); + } + + @Override + public String value5() { + return getTitle(); + } + + @Override + public String value6() { + return getContent(); + } + + @Override + public Timestamp value7() { + return getPublishTime(); + } + + @Override + public Integer value8() { + return getState(); + } + + @Override + public String value9() { + return getLang(); + } + + @Override + public TUniNoticeRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TUniNoticeRecord value2(Timestamp value) { + setCreateTime(value); + return this; + } + + @Override + public TUniNoticeRecord value3(Timestamp value) { + setUpdateTime(value); + return this; + } + + @Override + public TUniNoticeRecord value4(Byte value) { + setFlag(value); + return this; + } + + @Override + public TUniNoticeRecord value5(String value) { + setTitle(value); + return this; + } + + @Override + public TUniNoticeRecord value6(String value) { + setContent(value); + return this; + } + + @Override + public TUniNoticeRecord value7(Timestamp value) { + setPublishTime(value); + return this; + } + + @Override + public TUniNoticeRecord value8(Integer value) { + setState(value); + return this; + } + + @Override + public TUniNoticeRecord value9(String value) { + setLang(value); + return this; + } + + @Override + public TUniNoticeRecord values(Integer value1, Timestamp value2, Timestamp value3, Byte value4, String value5, String value6, Timestamp value7, Integer value8, String value9) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TUniNoticeRecord + */ + public TUniNoticeRecord() { + super(TUniNoticeTable.T_UNI_NOTICE); + } + + /** + * Create a detached, initialised TUniNoticeRecord + */ + public TUniNoticeRecord(Integer id, Timestamp createTime, Timestamp updateTime, Byte flag, String title, String content, Timestamp publishTime, Integer state, String lang) { + super(TUniNoticeTable.T_UNI_NOTICE); + + set(0, id); + set(1, createTime); + set(2, updateTime); + set(3, flag); + set(4, title); + set(5, content); + set(6, publishTime); + set(7, state); + set(8, lang); + } +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/ActivityMapper.java b/alive-db/src/main/java/com/alive/db/mapper/ActivityMapper.java new file mode 100644 index 0000000..05b93c9 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/ActivityMapper.java @@ -0,0 +1,24 @@ +package com.alive.db.mapper; + +import com.alive.db.entity.Vo.InviteContributeVo; +import com.alive.db.entity.Vo.RankingSummaryVo; +import com.alive.db.entity.Vo.RankingVo; + +import java.util.List; +import java.util.Set; + +/** + * 节点认购记录Mapper接口 + * + * @author HayDen + * @date 2024-01-09 + */ +public interface ActivityMapper +{ + + List findInviteContributeVoList(Set addressList); + + List findRankingVoList(Set addressList); + + RankingSummaryVo findRankingSummaryVo(String address); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/NodeBuyLogMapper.java b/alive-db/src/main/java/com/alive/db/mapper/NodeBuyLogMapper.java new file mode 100644 index 0000000..9d1c180 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/NodeBuyLogMapper.java @@ -0,0 +1,83 @@ +package com.alive.db.mapper; + +import java.util.List; + +import com.alive.db.entity.Vo.WordNodeVo; +import com.alive.db.entity.NodeBuyLog; +import com.alive.db.entity.Vo.InviteVo; +import com.alive.db.entity.Vo.UserTeamVo; + +/** + * 节点认购记录Mapper接口 + * + * @author HayDen + * @date 2024-01-09 + */ +public interface NodeBuyLogMapper +{ + /** + * 查询节点认购记录 + * + * @param id 节点认购记录ID + * @return 节点认购记录 + */ + NodeBuyLog selectNodeSubscribeById(Integer id); + + UserTeamVo findUserAddressById(Integer id); + + /** + * 查询节点认购记录列表 + * + * @param nodeSubscribe 节点认购记录 + * @return 节点认购记录集合 + */ + List selectNodeSubscribeList(NodeBuyLog nodeSubscribe); + + /** + * 查询节点认购记录对象 + * + * @param nodeSubscribe 节点认购记录 + * @return 节点认购记录 + */ + NodeBuyLog findNodeSubscribe(NodeBuyLog nodeSubscribe); + + /** + * 根据订单号查询数据 + * @param nodeSubscribe + * @return + */ + NodeBuyLog findNodeSubscribeByOrderNumber(String orderNumber); + + + WordNodeVo findWordNodeVo(Integer userId); + + /** + * 新增节点认购记录 + * + * @param nodeSubscribe 节点认购记录 + * @return 结果 + */ + int insertNodeSubscribe(NodeBuyLog nodeSubscribe); + + /** + * 修改节点认购记录 + * + * @param nodeSubscribe 节点认购记录 + * @return 结果 + */ + int updateNodeSubscribe(NodeBuyLog nodeSubscribe); + + /** + * 批量删除节点认购记录 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteNodeSubscribeByIds(String[] ids); + + List findInviteVoList(Integer referId); + + Integer countBuyLogByUserId(NodeBuyLog nodeBuyLog); + + Integer sumBuyCount(Integer userId); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/NodeNftConfigMapper.java b/alive-db/src/main/java/com/alive/db/mapper/NodeNftConfigMapper.java new file mode 100644 index 0000000..73faaea --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/NodeNftConfigMapper.java @@ -0,0 +1,64 @@ +package com.alive.db.mapper; + +import java.util.List; +import com.alive.db.entity.NodeNftConfig; + +/** + * NFT碎片配置Mapper接口 + * + * @author HayDen + * @date 2024-01-09 + */ +public interface NodeNftConfigMapper +{ + /** + * 查询NFT碎片配置 + * + * @param id NFT碎片配置ID + * @return NFT碎片配置 + */ + NodeNftConfig selectNodeNftConfigById(Integer id); + + /** + * 查询NFT碎片配置列表 + * + * @param nodeNftConfig NFT碎片配置 + * @return NFT碎片配置集合 + */ + List selectNodeNftConfigList(NodeNftConfig nodeNftConfig); + + /** + * 查询NFT碎片配置对象 + * + * @param nodeNftConfig NFT碎片配置 + * @return NFT碎片配置 + */ + NodeNftConfig findNodeNftConfig(NodeNftConfig nodeNftConfig); + + /** + * 新增NFT碎片配置 + * + * @param nodeNftConfig NFT碎片配置 + * @return 结果 + */ + int insertNodeNftConfig(NodeNftConfig nodeNftConfig); + + /** + * 修改NFT碎片配置 + * + * @param nodeNftConfig NFT碎片配置 + * @return 结果 + */ + int updateNodeNftConfig(NodeNftConfig nodeNftConfig); + + /** + * 批量删除NFT碎片配置 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteNodeNftConfigByIds(String[] ids); + + NodeNftConfig findNodeNftConfigById(Integer id); + +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/NodePriceConfigMapper.java b/alive-db/src/main/java/com/alive/db/mapper/NodePriceConfigMapper.java new file mode 100644 index 0000000..9f3ae1e --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/NodePriceConfigMapper.java @@ -0,0 +1,65 @@ +package com.alive.db.mapper; + +import java.math.BigDecimal; +import java.util.List; +import com.alive.db.entity.NodePriceConfig; +import org.apache.ibatis.annotations.Param; + +/** + * 节点价格区间配置Mapper接口 + * + * @author HayDen + * @date 2024-01-09 + */ +public interface NodePriceConfigMapper +{ + /** + * 查询节点价格区间配置 + * + * @param id 节点价格区间配置ID + * @return 节点价格区间配置 + */ + NodePriceConfig selectNodePriceConfigById(Integer id); + + /** + * 查询节点价格区间配置列表 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 节点价格区间配置集合 + */ + List selectNodePriceConfigList(NodePriceConfig nodePriceConfig); + + /** + * 查询节点价格区间配置对象 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 节点价格区间配置 + */ + NodePriceConfig findNodePriceConfig(NodePriceConfig nodePriceConfig); + + /** + * 新增节点价格区间配置 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 结果 + */ + int insertNodePriceConfig(NodePriceConfig nodePriceConfig); + + /** + * 修改节点价格区间配置 + * + * @param nodePriceConfig 节点价格区间配置 + * @return 结果 + */ + int updateNodePriceConfig(NodePriceConfig nodePriceConfig); + + /** + * 批量删除节点价格区间配置 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteNodePriceConfigByIds(String[] ids); + + BigDecimal getConfigPrice(@Param("nodeSettingId")Long nodeSettingId,@Param("number")Integer number); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/NodeSettingMapper.java b/alive-db/src/main/java/com/alive/db/mapper/NodeSettingMapper.java new file mode 100644 index 0000000..d1b25d4 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/NodeSettingMapper.java @@ -0,0 +1,72 @@ +package com.alive.db.mapper; + +import com.alive.db.entity.Vo.WordNodeVo; +import com.alive.db.entity.NodeSetting; +import com.alive.db.entity.Vo.UserInviteVo; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 节点设置Mapper接口 + * + * @author HayDen + * @date 2024-01-09 + */ +public interface NodeSettingMapper +{ + /** + * 查询节点设置 + * + * @param id 节点设置ID + * @return 节点设置 + */ + NodeSetting selectNodeSettingById(Integer id); + + /** + * 查询节点设置列表 + * + * @param nodeSetting 节点设置 + * @return 节点设置集合 + */ + List selectNodeSettingList(NodeSetting nodeSetting); + + /** + * 查询节点设置对象 + * + * @param nodeSetting 节点设置 + * @return 节点设置 + */ + NodeSetting findNodeSetting(NodeSetting nodeSetting); + + /** + * 新增节点设置 + * + * @param nodeSetting 节点设置 + * @return 结果 + */ + int insertNodeSetting(NodeSetting nodeSetting); + + /** + * 修改节点设置 + * + * @param nodeSetting 节点设置 + * @return 结果 + */ + int updateNodeSetting(NodeSetting nodeSetting); + + /** + * 批量删除节点设置 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteNodeSettingByIds(String[] ids); + + UserInviteVo findUserInviteVo(@Param("referId")Integer referId); + + Integer addInventory(@Param("buyCount")Integer buyCount,@Param("nodeSettingId") Integer nodeSettingId,@Param("purchasedAmount") BigDecimal purchasedAmount); + + List getWOrdNodePro(int memberId); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/PersonalCenterMapper.java b/alive-db/src/main/java/com/alive/db/mapper/PersonalCenterMapper.java new file mode 100644 index 0000000..4506d1d --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/PersonalCenterMapper.java @@ -0,0 +1,29 @@ +package com.alive.db.mapper; + + +import com.alive.db.entity.Vo.*; +import com.alive.db.entity.Vo.*; + +import java.util.List; + +public interface PersonalCenterMapper +{ + + RecommendVo referralReward(Integer memberId); + + + RecommendVo rewardStatisticsByRecommendId(Integer recommendId); + + RecommendVo rewardStatisticsByIndirectUserId(Integer indirectUserId); + + String sumRbitAmountById(Integer userId); + + List findTeamRewardVoList(Integer grade, Integer userId); + + MyIntegralVo myBonusPoints(Integer memberId, Integer coinId); + + List recommendedCompletionList(Integer memberId, Integer page, Integer size); + + + List nodeTask(Integer memberId); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/SysAccountMapper.java b/alive-db/src/main/java/com/alive/db/mapper/SysAccountMapper.java new file mode 100644 index 0000000..8eb0df4 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/SysAccountMapper.java @@ -0,0 +1,8 @@ +package com.alive.db.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.alive.db.entity.SysAccountEntity; + +public interface SysAccountMapper extends BaseMapper { + +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/SysMenuMapper.java b/alive-db/src/main/java/com/alive/db/mapper/SysMenuMapper.java new file mode 100644 index 0000000..112754c --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/SysMenuMapper.java @@ -0,0 +1,14 @@ +package com.alive.db.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.alive.db.dto.MenuDTO; +import com.alive.db.entity.SysMenuEntity; + +import java.util.List; + +public interface SysMenuMapper extends BaseMapper { + + List treeMenu(String[] array); + + List treePermission(); +} diff --git a/alive-db/src/main/java/com/alive/db/mapper/SysRoleMapper.java b/alive-db/src/main/java/com/alive/db/mapper/SysRoleMapper.java new file mode 100644 index 0000000..34f8583 --- /dev/null +++ b/alive-db/src/main/java/com/alive/db/mapper/SysRoleMapper.java @@ -0,0 +1,8 @@ +package com.alive.db.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.alive.db.entity.SysRoleEntity; + +public interface SysRoleMapper extends BaseMapper { + +} diff --git a/alive-db/src/main/resources/mapper/ActivityMapper.xml b/alive-db/src/main/resources/mapper/ActivityMapper.xml new file mode 100644 index 0000000..869ce91 --- /dev/null +++ b/alive-db/src/main/resources/mapper/ActivityMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/NodeBuyLogMapper.xml b/alive-db/src/main/resources/mapper/NodeBuyLogMapper.xml new file mode 100644 index 0000000..5b1f859 --- /dev/null +++ b/alive-db/src/main/resources/mapper/NodeBuyLogMapper.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, create_time, create_by,illustrate,rebate,node_setting_id,rbit_amount,indirect_user_id,rbit_one,rbit_two,nft_amount,nft_one,nft_two, update_time,input_address,out_address, update_by, wallet_address, recommend_id, buy_count, pay_coin, buy_amount, status, user_id, hash, order_number from node_buy_log + + + + + + + + + + + + + + + + + + + + + + + + insert into node_buy_log + + create_time, + wallet_address, + recommend_id, + buy_count, + pay_coin, + buy_amount, + node_setting_id, + status, + user_id, + hash, + order_number, + input_address, + out_address, + rebate, + rbit_amount, + rbit_one, + rbit_two, + nft_amount, + nft_one, + nft_two, + indirect_user_id, + illustrate, + + + #{createTime}, + #{walletAddress}, + #{recommendId}, + #{buyCount}, + #{payCoin}, + #{buyAmount}, + #{nodeSettingId}, + #{status}, + #{userId}, + #{hash}, + #{orderNumber}, + #{inputAddress}, + #{outAddress}, + #{rebate}, + #{rbitAmount}, + #{rbitOne}, + #{rbitTwo}, + #{nftAmount}, + #{nftOne}, + #{nftTwo}, + #{indirectUserId}, + #{illustrate}, + + + + + + update node_buy_log + + create_time = #{createTime}, + wallet_address = #{walletAddress}, + recommend_id = #{recommendId}, + indirect_user_id = #{indirectUserId}, + buy_count = #{buyCount}, + pay_coin = #{payCoin}, + buy_amount = #{buyAmount}, + node_setting_id = #{nodeSettingId}, + status = #{status}, + user_id = #{userId}, + hash = #{hash}, + order_number = #{orderNumber}, + input_address = #{inputAddress}, + out_address = #{outAddress}, + rebate = #{rebate}, + rbit_amount = #{rbitAmount}, + rbit_one = #{rbitOne}, + rbit_two = #{rbitTwo}, + nft_amount = #{nftAmount}, + nft_one = #{nftOne}, + nft_two = #{nftTwo}, + illustrate = #{illustrate}, + + where id = #{id} + + + + delete from node_buy_log where id in + + #{id} + + + + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/NodeNftConfigMapper.xml b/alive-db/src/main/resources/mapper/NodeNftConfigMapper.xml new file mode 100644 index 0000000..a402c6b --- /dev/null +++ b/alive-db/src/main/resources/mapper/NodeNftConfigMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + select id, create_time, create_by, update_time, update_by, status, start_num, end_num, amount from node_nft_config + + + + + + + + + + + + + insert into node_nft_config + + create_time, + create_by, + update_time, + update_by, + status, + start_num, + end_num, + amount, + + + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{status}, + #{startNum}, + #{endNum}, + #{amount}, + + + + + update node_nft_config + + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + status = #{status}, + start_num = #{startNum}, + end_num = #{endNum}, + amount = #{amount}, + + where id = #{id} + + + + delete from node_nft_config where id in + + #{id} + + + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/NodePriceConfigMapper.xml b/alive-db/src/main/resources/mapper/NodePriceConfigMapper.xml new file mode 100644 index 0000000..b24bf82 --- /dev/null +++ b/alive-db/src/main/resources/mapper/NodePriceConfigMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + select id, create_time, create_by, update_time, update_by, node_setting_id, start_num, end_num, price from node_price_config + + + + + + + + + + + + + insert into node_price_config + + create_time, + create_by, + update_time, + update_by, + node_setting_id, + start_num, + end_num, + price, + + + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{nodeSettingId}, + #{startNum}, + #{endNum}, + #{price}, + + + + + update node_price_config + + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + node_setting_id = #{nodeSettingId}, + start_num = #{startNum}, + end_num = #{endNum}, + price = #{price}, + + where id = #{id} + + + + delete from node_price_config where id in + + #{id} + + + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/NodeSettingMapper.xml b/alive-db/src/main/resources/mapper/NodeSettingMapper.xml new file mode 100644 index 0000000..ad8e4f4 --- /dev/null +++ b/alive-db/src/main/resources/mapper/NodeSettingMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + select id, create_time,title, create_by,node_price, update_time,node_name,illustrate, update_by, buy_coin_name, node_total, purchase_limit, purchased_count, purchased_amount, status from node_setting + + + + + + + + + + + + + + + + insert into node_setting + + create_time, + create_by, + update_time, + update_by, + buy_coin_name, + node_total, + purchase_limit, + purchased_count, + purchased_amount, + status, + node_name, + illustrate, + node_price, + title, + + + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{buyCoinName}, + #{nodeTotal}, + #{startPrice}, + #{purchaseLimit}, + #{purchasedCount}, + #{purchasedAmount}, + #{status}, + #{nodeName}, + #{illustrate}, + #{nodePrice}, + #{title}, + + + + + update node_setting + + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + buy_coin_name = #{buyCoinName}, + node_total = #{nodeTotal}, + purchase_limit = #{purchaseLimit}, + purchased_count = #{purchasedCount}, + purchased_amount = #{purchasedAmount}, + status = #{status}, + node_name = #{nodeName}, + illustrate = #{illustrate}, + node_price = #{nodePrice}, + title = #{title}, + + where id = #{id} + + + + delete from node_setting where id in + + #{id} + + + + + + update node_setting + + purchased_count = purchased_count + #{buyCount}, + purchased_amount=purchased_amount + #{purchasedAmount} + + where id = #{nodeSettingId} + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/PersonalCenterMapper.xml b/alive-db/src/main/resources/mapper/PersonalCenterMapper.xml new file mode 100644 index 0000000..caf8e54 --- /dev/null +++ b/alive-db/src/main/resources/mapper/PersonalCenterMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/alive-db/src/main/resources/mapper/SysMenuMapper.xml b/alive-db/src/main/resources/mapper/SysMenuMapper.xml new file mode 100644 index 0000000..939cece --- /dev/null +++ b/alive-db/src/main/resources/mapper/SysMenuMapper.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..835f352 --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.2.1.RELEASE + + + + com.alive + alive-api-server + pom + 1.0-SNAPSHOT + + + alive-db + alive-api + alive-commons + + + + 1.8 + 2.2.1.RELEASE + Greenwich.SR4 + + + + + + com.alive + alive-db + 1.0-SNAPSHOT + + + com.alive + alive-commons + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring.cloud.version} + pom + import + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + + \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..a4cca40 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# iNode + +本项目小数点固定8位