Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion wallet-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
apply plugin: 'java-library'

bootJar.enabled = false
jar.enabled = true

dependencies {
implementation project(":wallet-entity")
api project(":wallet-entity")
implementation 'commons-codec:commons-codec:1.16.0'
implementation 'org.bitcoinj:bitcoinj-core:0.14.7'
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ open class RestTemplateConfig {
@Bean
open fun rest(restTemplateBuilder: RestTemplateBuilder): RestTemplate {
val restTemplate = restTemplateBuilder
.connectTimeout(Duration.ofSeconds(10))
.readTimeout(Duration.ofSeconds(30))
.setConnectTimeout(Duration.ofSeconds(10))
.setReadTimeout(Duration.ofSeconds(30))
.build()
restTemplate.messageConverters.add(OctetStreamJsonConverter())
return restTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PushComponent : LogService() {

private fun getEncryptionKey(): String {
return pushEncryptionKey
?: throw BizException(ErrorCode.ERROR_PARAM, "Push encryption key not configured (wallet.crypto.push-key)")
?: throw BizException(ErrorCode.ERROR_PARAM.code, "Push encryption key not configured (wallet.crypto.push-key)")
}

fun sendMsgToMq(msg: String) {
Expand Down
10 changes: 9 additions & 1 deletion wallet-common/src/main/kotlin/com/wallet/biz/rpc/TrxApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ class TrxApi(val url: String, val restTemplate: RestTemplate) {
val sBytes = signature.s.toByteArray()
System.arraycopy(rBytes, Math.max(0, rBytes.size - 32), sigBytes, Math.max(0, 32 - rBytes.size), Math.min(32, rBytes.size))
System.arraycopy(sBytes, Math.max(0, sBytes.size - 32), sigBytes, Math.max(0, 64 - sBytes.size), Math.min(32, sBytes.size))
sigBytes[64] = ecKey.findRecoveryId(org.bitcoinj.core.Sha256Hash.wrap(txIdBytes), signature).toByte()
var recId = -1
for (i in 0..3) {
val recovered = org.bitcoinj.core.ECKey.recoverFromSignature(i, signature, org.bitcoinj.core.Sha256Hash.wrap(txIdBytes), false)
if (recovered != null && recovered.pubKeyPoint == ecKey.pubKeyPoint) {
recId = i
break
}
}
sigBytes[64] = recId.toByte()

val signatureHex = NumericUtil.bytesToHex(sigBytes)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ class AddressAdminServiceImpl: AddressAdminService {
}

override fun del(id: Long) {
addressAdminRepository.delete(id)
addressAdminRepository.deleteById(id)
}

override fun update(addressAdmin: AddressAdmin) {
val e = addressAdminRepository.findOne(addressAdmin.id)
val e = addressAdminRepository.findById(addressAdmin.id).orElse(null)
BasicUtils.copyPropertiesIgnoreNull(addressAdmin, e)
addressAdminRepository.save(e)
}

override fun getById(id:Long): AddressAdmin? {
return addressAdminRepository.findOne(id)
return addressAdminRepository.findById(id).orElse(null)
}

override fun save(addressAdmin:AddressAdmin): AddressAdmin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired
class AddressServiceImpl: AddressService {

override fun delete(id: Long) {
addressRepository.delete(id)
addressRepository.deleteById(id)
}

override fun findAllBitcoinFork(): List<Address> {
Expand Down Expand Up @@ -47,7 +47,7 @@ class AddressServiceImpl: AddressService {
}

override fun saveAll(list: List<Address>): List<Address> {
return addressRepository.save(list)
return addressRepository.saveAll(list)
}

override fun findByType(chainType: String?): List<Address> {
Expand All @@ -62,7 +62,7 @@ class AddressServiceImpl: AddressService {
}

override fun getById(id:Long): Address? {
return addressRepository.findOne(id)
return addressRepository.findById(id).orElse(null)
}

override fun save(address:Address): Address {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired
class BlockHeightServiceImpl: BlockHeightService {

override fun getById(id:Long): BlockHeight? {
return blockHeightRepository.findOne(id)
return blockHeightRepository.findById(id).orElse(null)
}

override fun save(blockHeight:BlockHeight): BlockHeight {
Expand All @@ -33,13 +33,13 @@ class BlockHeightServiceImpl: BlockHeightService {
}

override fun update(blockHeight: BlockHeight) {
val e=blockHeightRepository.findOne(blockHeight.id)
val e=blockHeightRepository.findById(blockHeight.id).orElse(null)
BasicUtils.copyPropertiesIgnoreNull(blockHeight,e)
blockHeightRepository.save(e)
}

override fun del(id: Long) {
blockHeightRepository.delete(id)
blockHeightRepository.deleteById(id)
}

@Autowired lateinit var blockHeightRepository: BlockHeightRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired
class ConfigServiceImpl: ConfigService {

override fun getById(id:Long): Config? {
return configRepository.findOne(id)
return configRepository.findById(id).orElse(null)
}

override fun save(config:Config): Config {
Expand All @@ -33,13 +33,13 @@ class ConfigServiceImpl: ConfigService {
}

override fun update(config: Config) {
val e=configRepository.findOne(config.id)
val e=configRepository.findById(config.id).orElse(null)
BasicUtils.copyPropertiesIgnoreNull(config,e)
configRepository.save(e)
}

override fun del(id: Long) {
configRepository.delete(id)
configRepository.deleteById(id)
}

@Autowired lateinit var configRepository: ConfigRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DepositServiceImpl: DepositService {
}

override fun saveAll(list: List<Deposit>): List<Deposit> {
return depositRepository.save(list)
return depositRepository.saveAll(list)
}

override fun getByIsUpload(isUpload: Int): List<Deposit> {
Expand Down Expand Up @@ -53,11 +53,11 @@ class DepositServiceImpl: DepositService {
pre=pre.and(QDeposit.deposit.tokenSymbol.eq(entity.tokenSymbol))
if(entity.chainType!=null)
pre=pre.and(QDeposit.deposit.chainType.eq(entity.chainType))
return depositRepository.findAll(pre, PageRequest(find.page, find.size))
return depositRepository.findAll(pre, PageRequest.of(find.page, find.size))
}

override fun getById(id:Long): Deposit? {
return depositRepository.findOne(id)
return depositRepository.findById(id).orElse(null)
}

override fun save(deposit:Deposit): Deposit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ class TokenServiceImpl: TokenService {
}

override fun update(token: Token) {
val e=tokenRepository.findOne(token.id)
val e=tokenRepository.findById(token.id).orElse(null)
BasicUtils.copyPropertiesIgnoreNull(token,e)
tokenRepository.save(e)
}

override fun del(id: Long) {
return tokenRepository.delete(id)
return tokenRepository.deleteById(id)
}

override fun getById(id:Long): Token? {
return tokenRepository.findOne(id)
return tokenRepository.findById(id).orElse(null)
}

override fun save(token:Token): Token {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired
class UserServiceImpl: UserService {

override fun getById(id:Long): User? {
return userRepository.findOne(id)
return userRepository.findById(id).orElse(null)
}

override fun save(user: User): User {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class WaitCollectServiceImpl: WaitCollectService {
if (waitCollect.chainType == null) return
val list = getByBean(waitCollect)

waitCollectRepository.delete(list)
waitCollectRepository.deleteAll(list)
}

override fun getByBean(waitCollect: WaitCollect): List<WaitCollect> {
Expand All @@ -34,7 +34,7 @@ class WaitCollectServiceImpl: WaitCollectService {
}

override fun getById(id:Long): WaitCollect? {
return waitCollectRepository.findOne(id)
return waitCollectRepository.findById(id).orElse(null)
}

override fun save(waitCollect:WaitCollect): WaitCollect {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import org.springframework.beans.factory.annotation.Autowired
class WaitImportServiceImpl: WaitImportService {

override fun getById(id:Long): WaitImport? {
return waitImportRepository.findOne(id)
return waitImportRepository.findById(id).orElse(null)
}

override fun save(waitImport:WaitImport): WaitImport {
return waitImportRepository.saveAndFlush(waitImport)
}

override fun saveAll(waitImportList: List<WaitImport>): List<WaitImport> {
return waitImportRepository.save(waitImportList)
return waitImportRepository.saveAll(waitImportList)
}

override fun findAll(): List<WaitImport> {
return waitImportRepository.findAll()
}

override fun deleteById(id: Long) {
waitImportRepository.delete(id)
waitImportRepository.deleteById(id)
}

@Autowired lateinit var waitImportRepository: WaitImportRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.springframework.data.domain.PageRequest
class WhiteServiceImpl: WhiteService {

override fun getById(id:Long): White? {
return whiteRepository.findOne(id)
return whiteRepository.findById(id).orElse(null)
}

override fun save(white:White): White {
Expand All @@ -27,21 +27,21 @@ class WhiteServiceImpl: WhiteService {
val entity = find.entity
if (entity.ip != null)
pre = pre.and(QWhite.white.ip.eq(entity.ip).or(QWhite.white.ip.eq("0.0.0.0")))
return whiteRepository.findAll(pre, PageRequest(find.page, find.size))
return whiteRepository.findAll(pre, PageRequest.of(find.page, find.size))
}

override fun findAll(): List<White> {
return whiteRepository.findAll()
}

override fun update(white: White) {
val e=whiteRepository.findOne(white.id)
val e=whiteRepository.findById(white.id).orElse(null)
BasicUtils.copyPropertiesIgnoreNull(white,e)
whiteRepository.save(e)
}

override fun del(id: Long) {
whiteRepository.delete(id)
whiteRepository.deleteById(id)
}

@Autowired lateinit var whiteRepository: WhiteRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WithdrawServiceImpl : WithdrawService {
pre = pre.and(QWithdraw.withdraw.withdrawType.eq(entity.withdrawType))
val sort = QSort(QWithdraw.withdraw.createdAt.desc())

return withdrawRepository.findAll(pre, PageRequest(find.page, find.size, sort))
return withdrawRepository.findAll(pre, PageRequest.of(find.page, find.size, sort))
}

override fun findAll(): List<Withdraw> {
Expand All @@ -40,7 +40,7 @@ class WithdrawServiceImpl : WithdrawService {
}

override fun getById(id: Long): Withdraw? {
return withdrawRepository.findOne(id)
return withdrawRepository.findById(id).orElse(null)
}

override fun save(withdraw: Withdraw): Withdraw {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ open class WalletXServiceImpl : WalletXService, LogService() {
txLogVo.type = TxLogDict.DEPOSIT
txLogVo
}
PageImpl(pageList.toList(), PageRequest(page, size), pageList.totalElements)
PageImpl(pageList.toList(), PageRequest.of(page, size), pageList.totalElements)
}
TxLogDict.WITHDRAW -> {
val find = PageEntity(Withdraw())
Expand All @@ -90,7 +90,7 @@ open class WalletXServiceImpl : WalletXService, LogService() {
txLogVo.type = TxLogDict.WITHDRAW
txLogVo
}
PageImpl(pageList.toList(), PageRequest(page, size), pageList.totalElements)
PageImpl(pageList.toList(), PageRequest.of(page, size), pageList.totalElements)
}
TxLogDict.COLLECT -> {
val find = PageEntity(Withdraw())
Expand All @@ -109,7 +109,7 @@ open class WalletXServiceImpl : WalletXService, LogService() {
txLogVo.type = TxLogDict.WITHDRAW
txLogVo
}
PageImpl(pageList.toList(), PageRequest(page, size), pageList.totalElements)
PageImpl(pageList.toList(), PageRequest.of(page, size), pageList.totalElements)
}
TxLogDict.SEND_FEE -> {
val find = PageEntity(Withdraw())
Expand All @@ -128,7 +128,7 @@ open class WalletXServiceImpl : WalletXService, LogService() {
txLogVo.type = TxLogDict.WITHDRAW
txLogVo
}
PageImpl(pageList.toList(), PageRequest(page, size), pageList.totalElements)
PageImpl(pageList.toList(), PageRequest.of(page, size), pageList.totalElements)
}
else -> throw BizException(ErrorCode.ERROR_PARAM)
}
Expand Down
11 changes: 7 additions & 4 deletions wallet-entity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apply plugin: 'java-library'

bootJar.enabled = false
jar.enabled = true

dependencies {
implementation "com.querydsl:querydsl-jpa:$querydslVersion:jakarta"
implementation "com.querydsl:querydsl-sql-spring:$querydslVersion"
implementation "com.querydsl:querydsl-sql:$querydslVersion"
implementation "com.querydsl:querydsl-core:$querydslVersion"
api "com.querydsl:querydsl-jpa:$querydslVersion:jakarta"
api "com.querydsl:querydsl-sql-spring:$querydslVersion"
api "com.querydsl:querydsl-sql:$querydslVersion"
api "com.querydsl:querydsl-core:$querydslVersion"
api 'io.github.qyvlik:io.eblock.eos-eos4j:1.0.1'
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.wallet.biz.domain.po

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import io.swagger.v3.oas.annotations.media.Schema
/**

* Created by pie on 2020/7/8 04: 34.

*/
@ApiModel
@Schema
class GetTransactionPo {

var chain:String?=null
Expand All @@ -16,7 +15,7 @@ class GetTransactionPo {

var type:Int?=null

@ApiModelProperty("合约地址")
@Schema(description = "合约地址")
var tokenAddress:String?=null

var limit:Int?=null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.wallet.biz.domain.po

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import io.swagger.v3.oas.annotations.media.Schema

@ApiModel
@Schema
class LoginPo{
@ApiModelProperty("用户名")
@Schema(description = "用户名")
var customerName:String?=null
@ApiModelProperty("密码")
@Schema(description = "密码")
var password:String?=null
}
Loading
Loading