Skip to content

Commit

Permalink
Merge pull request #197 from WeBankFinTech/dev
Browse files Browse the repository at this point in the history
v1.3.2 dev=>master
  • Loading branch information
mingzhenliu authored Jun 22, 2020
2 parents a771ccc + d9505bd commit bf4708e
Show file tree
Hide file tree
Showing 79 changed files with 721 additions and 489 deletions.
15 changes: 15 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### v1.3.2(2020-06-17)

**Fix**
- 移除Fastjson,替换为Jackson 2.11.0; web3sdk升级为2.4.1
- 升级依赖包:spring: 5.1.15; log4j: 2.13.3; slf4j: 1.7.30; netty-all: 4.1.44+; guava: 28.2;

**兼容性**
- 支持FISCO-BCOS v2.4.0 及以上版本
- WeBASE-Web v1.3.1+
- WeBASE-Front v1.3.1+
- WeBASE-Sign v1.3.1+
- WeBASE-Transaction v1.3.0+

详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)

### v1.3.1(2020-06-01)

**Add**
Expand Down
41 changes: 30 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,76 @@ repositories {
maven {url "http://maven.aliyun.com/nexus/content/groups/public/"}

maven { url 'https://dl.bintray.com/ethereum/maven/' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

mavenLocal()
mavenCentral()
}

def springboot_version="2.1.2.RELEASE"
def springboot_version="2.1.15.RELEASE"
List springboot = [
"org.springframework.boot:spring-boot-starter-web:$springboot_version",
"org.springframework.boot:spring-boot-starter-log4j2:$springboot_version",
"org.springframework.boot:spring-boot-starter-security:$springboot_version",
"org.springframework.boot:spring-boot-starter-mail:$springboot_version",
"org.springframework.boot:spring-boot-starter-thymeleaf:$springboot_version"
// "org.springframework.boot:spring-boot-starter-aop:$springboot_version"
]

// cover old version
def spring_version="5.1.15.RELEASE"
List spring =[
"org.springframework:spring-jdbc:$spring_version",
"org.springframework:spring-tx:$spring_version"
]

List jaxb = [
"javax.xml.bind:jaxb-api:2.3.0",
"com.sun.xml.bind:jaxb-impl:2.3.0",
"com.sun.xml.bind:jaxb-core:2.3.0",
"javax.activation:activation:1.1.1"
]

List web3jsdk = [
"org.fisco-bcos:web3sdk:2.4.0"
List web3sdk = [
"org.fisco-bcos:web3sdk:2.4.1"
]

List lombok = [

"org.projectlombok:lombok:1.18.2"
]

def jackson_version = "2.11.0"
List jackson = [
"com.fasterxml.jackson.core:jackson-databind:2.10.0",
"com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.0",
"com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.0",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.0"
"com.fasterxml.jackson.core:jackson-databind:$jackson_version",
"com.fasterxml.jackson.core:jackson-annotations:$jackson_version",
"com.fasterxml.jackson.core:jackson-core:$jackson_version",
"com.fasterxml.jackson.module:jackson-module-parameter-names:$jackson_version",
"com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jackson_version",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
]

List test = [
"org.springframework.boot:spring-boot-starter-test:$springboot_version"
]

def log4j_version="2.13.3"
List log4j = [
"org.apache.logging.log4j:log4j-api:$log4j_version",
"org.apache.logging.log4j:log4j-core:$log4j_version",
"org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version",
"org.apache.logging.log4j:log4j-web:$log4j_version"
]

dependencies {
compile springboot,jaxb,web3jsdk,jackson
compile springboot,spring,jaxb,web3sdk,jackson,log4j
compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:2.0.0"
compile "org.apache.commons:commons-lang3:3.8.1"
compile "com.alibaba:fastjson:1.2.70"
compile "mysql:mysql-connector-java:8.0.13"
compile "com.zaxxer:HikariCP:3.2.0"
compile "com.github.sgroschupf:zkclient:0.1"
compile 'org.bouncycastle:bcprov-jdk15on:1.54'
// cover old version
compile 'com.google.guava:guava:28.2-jre'
compile 'org.slf4j:jcl-over-slf4j:1.7.30'

annotationProcessor 'org.projectlombok:lombok:1.18.6'
compileOnly lombok
Expand Down
1 change: 1 addition & 0 deletions release_note.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
V1.3.2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.webank.webase.node.mgr.abi;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.abi.entity.AbiInfo;
import com.webank.webase.node.mgr.abi.entity.ReqAbiListParam;
import com.webank.webase.node.mgr.abi.entity.ReqImportAbi;
Expand All @@ -26,6 +26,7 @@
import com.webank.webase.node.mgr.base.entity.BaseResponse;
import com.webank.webase.node.mgr.base.enums.SqlSortType;
import com.webank.webase.node.mgr.base.properties.ConstantProperties;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
Expand Down Expand Up @@ -88,7 +89,7 @@ public Object saveAbi(@Valid @RequestBody ReqImportAbi param, BindingResult resu
checkBindResult(result);
Instant startTime = Instant.now();
log.info("start saveAbi. startTime:{} ReqImportAbi:{}",
startTime.toEpochMilli(), JSON.toJSONString(param));
startTime.toEpochMilli(), JsonTools.toJSONString(param));
abiService.saveAbi(param);
log.info("end saveAbi. useTime:{}",
Duration.between(startTime, Instant.now()).toMillis());
Expand All @@ -105,7 +106,7 @@ public Object updateAbi(@RequestBody ReqImportAbi param, BindingResult result) {
checkBindResult(result);
Instant startTime = Instant.now();
log.info("start updateAbi. startTime:{} ReqImportAbi:{}",
startTime.toEpochMilli(), JSON.toJSONString(param));
startTime.toEpochMilli(), JsonTools.toJSONString(param));
if(param.getAbiId() == null) {
return new BaseResponse(ConstantCode.PARAM_FAIL_ABI_ID_EMPTY);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/webank/webase/node/mgr/abi/AbiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.webank.webase.node.mgr.abi;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.abi.entity.AbiInfo;
import com.webank.webase.node.mgr.abi.entity.ReqAbiListParam;
import com.webank.webase.node.mgr.abi.entity.ReqImportAbi;
Expand Down Expand Up @@ -66,7 +66,7 @@ public void insertAbiInfo(ReqImportAbi param) {
String contractAddress = param.getContractAddress();
String contractAbiStr;
try {
contractAbiStr = JSON.toJSONString(param.getContractAbi());
contractAbiStr = JsonTools.toJSONString(param.getContractAbi());
} catch (Exception e) {
log.warn("abi parse string error:{}", param.getContractAbi());
throw new NodeMgrException(ConstantCode.PARAM_FAIL_ABI_INVALID);
Expand Down Expand Up @@ -95,7 +95,7 @@ public void updateAbiInfo(ReqImportAbi param) {
BeanUtils.copyProperties(param, updateAbi);
String contractAbiStr;
try {
contractAbiStr = JSON.toJSONString(param.getContractAbi());
contractAbiStr = JsonTools.toJSONString(param.getContractAbi());
} catch (Exception e) {
log.warn("abi parse string error:{}", param.getContractAbi());
throw new NodeMgrException(ConstantCode.PARAM_FAIL_ABI_INVALID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.account.entity.AccountInfo;
import com.webank.webase.node.mgr.account.entity.AccountListParam;
import com.webank.webase.node.mgr.account.entity.ImageToken;
Expand Down Expand Up @@ -82,7 +82,7 @@ public BaseResponse getPictureCheckCode() throws Exception {
tokenData.setToken(token);
tokenData.setBase64Image(base64Image);
baseResponse.setData(tokenData);
log.info("end getPictureCheckCode. baseResponse:{}", JSON.toJSONString(baseResponse));
log.info("end getPictureCheckCode. baseResponse:{}", JsonTools.toJSONString(baseResponse));
return baseResponse;
} catch (Exception e) {
log.error("fail getPictureCheckCode", e);
Expand All @@ -102,7 +102,7 @@ public BaseResponse addAccountInfo(@RequestBody @Valid AccountInfo info, Binding
BaseResponse baseResponse = new BaseResponse(ConstantCode.SUCCESS);
Instant startTime = Instant.now();
log.info("start addAccountInfo. startTime:{} accountInfo:{}", startTime.toEpochMilli(),
JSON.toJSONString(info));
JsonTools.toJSONString(info));

// add account row
accountService.addAccountRow(info);
Expand All @@ -113,7 +113,7 @@ public BaseResponse addAccountInfo(@RequestBody @Valid AccountInfo info, Binding
baseResponse.setData(tbAccount);

log.info("end addAccountInfo useTime:{} result:{}",
Duration.between(startTime, Instant.now()).toMillis(), JSON.toJSONString(baseResponse));
Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(baseResponse));
return baseResponse;
}

Expand All @@ -128,7 +128,7 @@ public BaseResponse updateAccountInfo(@RequestBody @Valid AccountInfo info, Http
BaseResponse baseResponse = new BaseResponse(ConstantCode.SUCCESS);
Instant startTime = Instant.now();
log.info("start updateAccountInfo startTime:{} accountInfo:{}", startTime.toEpochMilli(),
JSON.toJSONString(info));
JsonTools.toJSONString(info));

// current
String currentAccount = getCurrentAccount(request);
Expand All @@ -143,7 +143,7 @@ public BaseResponse updateAccountInfo(@RequestBody @Valid AccountInfo info, Http

log.info("end updateAccountInfo useTime:{} result:{}",
Duration.between(startTime, Instant.now()).toMillis(),
JSON.toJSONString(baseResponse));
JsonTools.toJSONString(baseResponse));
return baseResponse;
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public BasePageResponse queryAccountList(@PathVariable("pageNumber") Integer pag
}

log.info("end queryAccountList useTime:{} result:{}",
Duration.between(startTime, Instant.now()).toMillis(), JSON.toJSONString(pagesponse));
Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(pagesponse));
return pagesponse;
}

Expand All @@ -191,7 +191,7 @@ public BaseResponse deleteAccount(@PathVariable("account") String account)
accountService.deleteAccountRow(account);

log.info("end deleteAccount. useTime:{} result:{}",
Duration.between(startTime, Instant.now()).toMillis(), JSON.toJSONString(baseResponse));
Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(baseResponse));
return baseResponse;
}

Expand All @@ -205,7 +205,7 @@ public BaseResponse updatePassword(@RequestBody @Valid PasswordInfo info, HttpSe
BaseResponse baseResponse = new BaseResponse(ConstantCode.SUCCESS);
Instant startTime = Instant.now();
log.info("start updatePassword startTime:{} passwordInfo:{}", startTime.toEpochMilli(),
JSON.toJSONString(info));
JsonTools.toJSONString(info));

String targetAccount = getCurrentAccount(request);

Expand All @@ -214,7 +214,7 @@ public BaseResponse updatePassword(@RequestBody @Valid PasswordInfo info, HttpSe
.updatePassword(targetAccount, info.getOldAccountPwd(), info.getNewAccountPwd());

log.info("end updatePassword useTime:{} result:{}",
Duration.between(startTime, Instant.now()).toMillis(), JSON.toJSONString(baseResponse));
Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(baseResponse));
return baseResponse;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.webank.webase.node.mgr.account;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.account.entity.AccountInfo;
import com.webank.webase.node.mgr.account.entity.AccountListParam;
import com.webank.webase.node.mgr.account.entity.LoginInfo;
Expand Down Expand Up @@ -51,7 +51,7 @@ public class AccountService {
* login.
*/
public TbAccountInfo login(LoginInfo loginInfo) throws NodeMgrException {
log.info("start login. loginInfo:{}", JSON.toJSONString(loginInfo));
log.info("start login. loginInfo:{}", JsonTools.toJSONString(loginInfo));
String accountStr = loginInfo.getAccount();
String passwordStr = loginInfo.getAccountPwd();

Expand Down Expand Up @@ -81,7 +81,7 @@ public TbAccountInfo login(LoginInfo loginInfo) throws NodeMgrException {
* add account row.
*/
public void addAccountRow(AccountInfo accountInfo) throws NodeMgrException {
log.debug("start addAccountRow. AccountInfo:{} ", JSON.toJSONString(accountInfo));
log.debug("start addAccountRow. AccountInfo:{} ", JsonTools.toJSONString(accountInfo));

String accountStr = accountInfo.getAccount();
Integer roleId = accountInfo.getRoleId();
Expand All @@ -108,7 +108,7 @@ public void addAccountRow(AccountInfo accountInfo) throws NodeMgrException {
public void updateAccountRow(String currentAccount, AccountInfo accountInfo)
throws NodeMgrException {
log.debug("start updateAccountRow. currentAccount:{} AccountInfo:{} ", currentAccount,
JSON.toJSONString(accountInfo));
JsonTools.toJSONString(accountInfo));

String accountStr = accountInfo.getAccount();
// check account
Expand Down Expand Up @@ -183,7 +183,7 @@ public void updatePassword(String targetAccount, String oldAccountPwd, String ne
public TbAccountInfo queryByAccount(String accountStr) {
log.debug("start queryByAccount. accountStr:{} ", accountStr);
TbAccountInfo accountRow = accountMapper.queryByAccount(accountStr);
log.debug("end queryByAccount. accountRow:{} ", JSON.toJSONString(accountRow));
log.debug("end queryByAccount. accountRow:{} ", JsonTools.toJSONString(accountRow));
return accountRow;
}

Expand All @@ -202,9 +202,9 @@ public int countOfAccount(String account) {
* query account list.
*/
public List<TbAccountInfo> listOfAccount(AccountListParam param) {
log.debug("start listOfAccount. param:{} ", JSON.toJSONString(param));
log.debug("start listOfAccount. param:{} ", JsonTools.toJSONString(param));
List<TbAccountInfo> list = accountMapper.listOfAccount(param);
log.debug("end listOfAccount. list:{} ", JSON.toJSONString(list));
log.debug("end listOfAccount. list:{} ", JsonTools.toJSONString(list));
return list;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.webank.webase.node.mgr.alert.log;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.alert.log.entity.AlertLog;
import com.webank.webase.node.mgr.alert.log.entity.ReqLogListParam;
import com.webank.webase.node.mgr.alert.log.entity.ReqLogParam;
Expand Down Expand Up @@ -78,7 +78,7 @@ public Object listAlertLog(@PathVariable("pageNumber") Integer pageNumber,
public Object updateAlertLog(@RequestBody ReqLogParam param) {
Instant startTime = Instant.now();
log.info("start updateAlertLog. startTime:{} ReqAlertLogParam:{}",
startTime.toEpochMilli(), JSON.toJSONString(param));
startTime.toEpochMilli(), JsonTools.toJSONString(param));
if(param.getStatus() == null || param.getLogId() == null) {
return new BaseResponse(ConstantCode.ALERT_LOG_PARAM_EMPTY);
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public Object getAlertLogById(@PathVariable("logId") Integer logId) {
// public Object saveAlertLog(@RequestBody ReqLogParam param) {
// Instant startTime = Instant.now();
// log.info("start saveAlertLog. startTime:{} ReqAlertLogParam:{}",
// startTime.toEpochMilli(), JSON.toJSONString(param));
// startTime.toEpochMilli(), JsonTools.toJSONString(param));
// if(StringUtils.isEmpty(param.getAlertContent()) ||
// StringUtils.isEmpty(param.getAlertLevel()) ||
// StringUtils.isEmpty(param.getAlertType())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package com.webank.webase.node.mgr.alert.mail;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.exception.NodeMgrException;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.account.AccountMapper;
import com.webank.webase.node.mgr.base.code.ConstantCode;
import com.webank.webase.node.mgr.account.entity.AccountListParam;
import com.webank.webase.node.mgr.account.entity.TbAccountInfo;
import com.webank.webase.node.mgr.alert.log.AlertLogService;
Expand Down Expand Up @@ -321,7 +323,10 @@ public void handleAllUserEmail(TbAlertRule alertRule, String emailTitle, String
}else {
List<String> userList = new ArrayList<>();
try {
userList = (List<String>) JSON.parse(alertRule.getUserList());
userList = JsonTools.toJavaObjectList(alertRule.getUserList(), String.class);
if (userList == null) {
log.error("parse json error");
}
}catch (Exception e) {
log.error("handleAllUserEmail parse error: e:{}, getUserList{}",
e, alertRule.getUserList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.webank.webase.node.mgr.alert.mail.server.config;

import com.alibaba.fastjson.JSON;
import com.webank.webase.node.mgr.base.tools.JsonTools;
import com.webank.webase.node.mgr.alert.mail.server.config.entity.ReqMailServerConfigParam;
import com.webank.webase.node.mgr.alert.mail.server.config.entity.TbMailServerConfig;
import com.webank.webase.node.mgr.base.code.ConstantCode;
Expand Down Expand Up @@ -83,7 +83,7 @@ public Object listServerConfig() {
public Object updateMailServerConfig(@RequestBody ReqMailServerConfigParam param) {
Instant startTime = Instant.now();
log.info("start updateMailServerConfig. startTime:{} ReqMailServerConfigParam:{}",
startTime.toEpochMilli(), JSON.toJSONString(param));
startTime.toEpochMilli(), JsonTools.toJSONString(param));
if(param.getServerId() == null) {
log.debug("updateMailServerConfig, error:{} ",
ConstantCode.MAIL_SERVER_CONFIG_PARAM_EMPTY);
Expand Down Expand Up @@ -112,7 +112,7 @@ public Object updateMailServerConfig(@RequestBody ReqMailServerConfigParam param
// public Object saveMailServerConfig(@RequestBody ReqMailServerConfigParam param) {
// Instant startTime = Instant.now();
// log.info("start saveMailServerConfig. startTime:{} ReqMailServerConfigParam:{}",
// startTime.toEpochMilli(), JSON.toJSONString(param));
// startTime.toEpochMilli(), JsonTools.toJSONString(param));
// try{
// mailServerConfigService.saveMailServerConfig(param);
// log.info("end saveMailServerConfig. useTime:{}",
Expand Down
Loading

0 comments on commit bf4708e

Please sign in to comment.