Skip to content

Commit 8834b10

Browse files
authored
Merge pull request #191 from WeBankFinTech/release/1.0.24
Release/1.0.24
2 parents 6207613 + 7aaf22c commit 8834b10

File tree

305 files changed

+33283
-79347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+33283
-79347
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### V1.0.24 (2021-03-29)
2+
3+
* 新增功能:
4+
1. 前端页面重构优化
5+
2. 集成WeBase辅助配置安装
6+
17
### V1.0.23 (2021-01-26)
28

39
* 新增功能:

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ WeIdentity JAVA SDK安装部署工具
99
版本说明
1010
--------
1111

12-
| weid-build-tools 版本 | weid-java-sdk 版本 | weid-contract-java 版本 |
13-
| :---- | :---- | :---- |
14-
| v1.0.23 | v1.8.0 | v1.2.29 |
15-
| v1.0.22 | v1.7.1 | v1.2.28 |
16-
| v1.0.21 | v1.7.0 | v1.2.27 |
17-
| v1.0.20 | v1.6.7 | v1.2.26 |
18-
| v1.0.19 | v1.6.6 | v1.2.24 |
19-
| v1.0.18 | v1.6.5 | v1.2.23 |
20-
| v1.0.12 | v1.6.4 | v1.2.21 |
12+
| weid-build-tools 版本 | weid-java-sdk 版本 | weid-contract-java 版本 | 备注 |
13+
| :---- | :---- | :---- | :---- |
14+
| v1.0.24 | v1.8.0 | v1.2.29 | 1.0.23的重构(前端重构)版本 |
15+
| v1.0.23 | v1.8.0 | v1.2.29 | - |
16+
| v1.0.22 | v1.7.1 | v1.2.28 | - |
17+
| v1.0.21 | v1.7.0 | v1.2.27 | - |
18+
| v1.0.20 | v1.6.7 | v1.2.26 | - |
19+
| v1.0.19 | v1.6.6 | v1.2.24 | - |
20+
| v1.0.18 | v1.6.5 | v1.2.23 | - |
21+
| v1.0.12 | v1.6.4 | v1.2.21 | - |

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.23
1+
1.0.24

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ List http_proxy = [
9393
]
9494

9595
List redis_driver = [
96-
"org.redisson:redisson:3.13.1"
96+
"org.redisson:redisson:3.15.0"
9797
]
9898

9999
def spring_version = "5.3.2"

src/main/java/com/webank/weid/app/BuildToolApplication.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919

2020
package com.webank.weid.app;
2121

22-
import java.security.InvalidAlgorithmParameterException;
23-
import java.security.NoSuchAlgorithmException;
24-
import java.security.NoSuchProviderException;
25-
2622
import org.springframework.boot.SpringApplication;
2723
import org.springframework.boot.autoconfigure.SpringBootApplication;
2824
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
2925
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
3026
import org.springframework.boot.web.servlet.ServletComponentScan;
3127
import org.springframework.context.ConfigurableApplicationContext;
28+
import org.springframework.context.annotation.Bean;
3229
import org.springframework.context.annotation.ComponentScan;
30+
import org.springframework.web.client.RestTemplate;
3331

3432
import com.webank.weid.config.StaticConfig;
3533

@@ -41,8 +39,13 @@ public class BuildToolApplication extends StaticConfig {
4139
public static String[] args;
4240
public static ConfigurableApplicationContext context;
4341

44-
public static void main(String[] args) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException {
42+
public static void main(String[] args) {
4543
BuildToolApplication.args = args;
4644
BuildToolApplication.context = SpringApplication.run(BuildToolApplication.class, args);
47-
}
45+
}
46+
47+
@Bean
48+
public RestTemplate restTemplate() {
49+
return new RestTemplate();
50+
}
4851
}

src/main/java/com/webank/weid/command/BatchTransaction.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121

2222
import java.util.Calendar;
2323

24+
import lombok.extern.slf4j.Slf4j;
2425
import org.apache.commons.lang3.StringUtils;
25-
import org.slf4j.Logger;
26-
import org.slf4j.LoggerFactory;
2726

2827
import com.beust.jcommander.JCommander;
2928
import com.webank.weid.config.StaticConfig;
@@ -36,13 +35,9 @@
3635
* @author yanggang
3736
*
3837
*/
38+
@Slf4j
3939
public class BatchTransaction extends StaticConfig {
4040

41-
/**
42-
* log4j.
43-
*/
44-
private static final Logger logger = LoggerFactory.getLogger(BatchTransaction.class);
45-
4641
//异步处理入口
4742
private static TransactionService transactionService = new TransactionService();
4843

@@ -95,13 +90,13 @@ public static void main(String[] args) {
9590
}
9691
} catch (Exception e) {
9792
String message = "[BatchTransaction] process has error.";
98-
logger.error(message, e);
93+
log.error(message, e);
9994
System.out.println(message);
10095
}
10196
System.exit(1);
10297
}
10398
private static void log(String message) {
104-
logger.info(message);
99+
log.info(message);
105100
System.out.println(message);
106101
}
107102
}

src/main/java/com/webank/weid/command/CreateWeId.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,38 @@
2121

2222
import java.io.File;
2323

24-
import org.slf4j.Logger;
25-
import org.slf4j.LoggerFactory;
24+
import lombok.extern.slf4j.Slf4j;
2625

2726
import com.webank.weid.config.StaticConfig;
2827
import com.webank.weid.constant.DataFrom;
29-
import com.webank.weid.service.BuildToolService;
28+
import com.webank.weid.constant.ErrorCode;
29+
import com.webank.weid.protocol.response.ResponseData;
30+
import com.webank.weid.service.WeIdSdkService;
3031
import com.webank.weid.util.FileUtils;
3132
import com.webank.weid.util.WeIdUtils;
3233

3334
/**
3435
* @author tonychen 2019/4/11
3536
*/
37+
@Slf4j
3638
public class CreateWeId extends StaticConfig {
3739

38-
/**
39-
* log4j.
40-
*/
41-
private static final Logger logger = LoggerFactory.getLogger(CreateWeId.class);
42-
43-
private static BuildToolService buildToolService = new BuildToolService();
40+
private static WeIdSdkService weIdSdkService = new WeIdSdkService();
4441

4542
/**
4643
* @param args 入参
4744
*/
4845
public static void main(String[] args) {
49-
logger.info("[CreateWeId] begin create weId.");
50-
String result = buildToolService.createWeId(DataFrom.COMMAND);
51-
if (!WeIdUtils.isWeIdValid(result)) {
52-
System.out.println("[CreateWeId] create WeID failed, result: " + result);
46+
log.info("[CreateWeId] begin create weId.");
47+
ResponseData<String> responseData = weIdSdkService.createWeId(DataFrom.COMMAND);
48+
if (responseData.getErrorCode() != ErrorCode.SUCCESS.getCode()) {
49+
System.out.println("[CreateWeId] create WeID failed, result: " + responseData.getErrorMessage());
5350
System.exit(1);
5451
}
55-
File weIdFile = buildToolService.getWeidDir(WeIdUtils.convertWeIdToAddress(result));
52+
File weIdFile = weIdSdkService.getWeidDir(WeIdUtils.convertWeIdToAddress(responseData.getResult()));
5653
if (weIdFile.exists()) {
57-
FileUtils.writeToFile(result, "weid");
58-
System.out.println("New weid has been created ---->" + result);
54+
FileUtils.writeToFile(responseData.getResult(), "weid");
55+
System.out.println("New weid has been created ---->" + responseData.getResult());
5956
System.out.println("The related private key and public key can be found at "
6057
+ weIdFile.getAbsolutePath());
6158
}

src/main/java/com/webank/weid/command/DataBaseInit.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,24 @@
1919

2020
package com.webank.weid.command;
2121

22-
import org.slf4j.Logger;
23-
import org.slf4j.LoggerFactory;
22+
import lombok.extern.slf4j.Slf4j;
2423

2524
import com.webank.weid.config.StaticConfig;
2625
import com.webank.weid.service.DataBaseService;
2726

2827
/**
2928
* @author tonychen 2019/4/11
3029
*/
30+
@Slf4j
3131
public class DataBaseInit extends StaticConfig {
3232

33-
/**
34-
* log4j.
35-
*/
36-
private static final Logger logger = LoggerFactory.getLogger(DataBaseInit.class);
37-
3833
private static DataBaseService dataBaseService = new DataBaseService();
3934

4035
/**
4136
* @param args 入参
4237
*/
4338
public static void main(String[] args) {
44-
logger.info("[DataBaseInit] begin init DataBase.");
39+
log.info("[DataBaseInit] begin init DataBase.");
4540
dataBaseService.initDataBase();
4641
System.exit(0);
4742
}

src/main/java/com/webank/weid/command/DeployContract.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
import com.webank.weid.contract.deploy.v2.DeployContractV2;
3434
import com.webank.weid.dto.DeployInfo;
3535
import com.webank.weid.protocol.base.WeIdPrivateKey;
36-
import com.webank.weid.service.BuildToolService;
3736
import com.webank.weid.service.ConfigService;
38-
import com.webank.weid.service.DeployService;
37+
import com.webank.weid.service.ContractService;
38+
import com.webank.weid.service.GuideService;
3939
import com.webank.weid.util.FileUtils;
40+
import com.webank.weid.util.WeIdSdkUtils;
4041

4142
public class DeployContract extends StaticConfig {
4243

@@ -45,10 +46,10 @@ public class DeployContract extends StaticConfig {
4546
*/
4647
private static final Logger logger = LoggerFactory.getLogger(DeployContract.class);
4748

48-
private static DeployService deployService = new DeployService();
49+
private static ContractService contractService = new ContractService();
4950
private static ConfigService configService = new ConfigService();
50-
private static BuildToolService buildToolService = new BuildToolService();
51-
51+
private static GuideService guideService = new GuideService();
52+
5253
public static void main(String[] args) {
5354
logger.info("[DeployContract] execute contract deployment.");
5455

@@ -60,37 +61,37 @@ public static void main(String[] args) {
6061
String chainId = commandArgs.getChainId();
6162
String privateKeyFile = commandArgs.getPrivateKey();
6263
// 获取配置
63-
FiscoConfig fiscoConfig = configService.loadNewFiscoConfig();
64+
FiscoConfig fiscoConfig = WeIdSdkUtils.loadNewFiscoConfig();
6465
fiscoConfig.setChainId(chainId);
6566
new EncryptType(Integer.parseInt(fiscoConfig.getEncryptType()));
6667
// 说明给了私钥文件
6768
if (StringUtils.isNotBlank(privateKeyFile)) {
6869
String privateKey = FileUtils.readFile(privateKeyFile);
69-
deployService.createAdmin(privateKey);
70+
guideService.createAdmin(privateKey);
7071
}
7172
// 部署合约
72-
String hash = deployService.deploy(fiscoConfig, DataFrom.COMMAND);
73+
String hash = contractService.deployContract(fiscoConfig, DataFrom.COMMAND);
7374
System.out.println("the contract deploy successfully --> hash : " + hash);
7475
// 配置启用新hash
75-
String oldHash = buildToolService.getMainHash();
76+
String oldHash = WeIdSdkUtils.getMainHash();
7677
// 获取部署数据
77-
DeployInfo deployInfo = deployService.getDeployInfoByHashFromChain(hash);
78+
DeployInfo deployInfo = contractService.getDeployInfoByHashFromChain(hash);
7879
ContractConfig contract = new ContractConfig();
7980
contract.setWeIdAddress(deployInfo.getWeIdAddress());
8081
contract.setIssuerAddress(deployInfo.getAuthorityAddress());
8182
contract.setSpecificIssuerAddress(deployInfo.getSpecificAddress());
8283
contract.setEvidenceAddress(deployInfo.getEvidenceAddress());
8384
contract.setCptAddress(deployInfo.getCptAddress());
84-
WeIdPrivateKey currentPrivateKey = DeployService.getCurrentPrivateKey();
85+
WeIdPrivateKey currentPrivateKey = WeIdSdkUtils.getCurrentPrivateKey();
8586
// 写入全局配置中
8687
DeployContractV2.putGlobalValue(fiscoConfig, contract, currentPrivateKey);
8788
System.out.println("begin enable the hash.");
8889
// 节点启用新hash并停用原hash
89-
deployService.enableHash(CnsType.DEFAULT, hash, oldHash);
90+
contractService.enableHash(CnsType.DEFAULT, hash, oldHash);
9091
//重新加载合约地址
9192
configService.reloadAddress();
9293
System.out.println("begin create the weId for admin and deploy the systemCpt.");
93-
deployService.deploySystemCpt(hash, DataFrom.COMMAND);
94+
contractService.deploySystemCpt(hash, DataFrom.COMMAND);
9495
System.out.println("the systemCpt deploy successfully.");
9596
System.exit(0);
9697
}

src/main/java/com/webank/weid/command/DeployEvidence.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
import com.webank.weid.config.FiscoConfig;
2727
import com.webank.weid.config.StaticConfig;
2828
import com.webank.weid.constant.DataFrom;
29-
import com.webank.weid.service.ConfigService;
30-
import com.webank.weid.service.DeployService;
29+
import com.webank.weid.service.ContractService;
30+
import com.webank.weid.service.GuideService;
31+
import com.webank.weid.util.WeIdSdkUtils;
3132

3233
public class DeployEvidence extends StaticConfig {
3334

34-
private static DeployService deployService = new DeployService();
35-
private static ConfigService configService = new ConfigService();
36-
35+
private static ContractService contractService = new ContractService();
36+
private static GuideService guideService = new GuideService();
37+
3738
public static void main(String[] args) {
3839
CommandArgs commandArgs = new CommandArgs();
3940
JCommander.newBuilder()
@@ -52,13 +53,13 @@ public static void main(String[] args) {
5253
System.out.println("[DeployEvidence] begin deploy the evidence by groupId, groupId = " + goupIdStr);
5354
Integer groupId = Integer.parseInt(goupIdStr);
5455
// 检查是否有admin账户,如果没有则创建admin账户
55-
String adminAddress = deployService.checkAdmin();
56+
String adminAddress = guideService.checkAdmin();
5657
if (StringUtils.isBlank(adminAddress)) {
5758
System.out.println("[DeployEvidence] begin create admin...");
58-
deployService.createAdmin(null);
59+
guideService.createAdmin(null);
5960
}
60-
FiscoConfig fiscoConfig = configService.loadNewFiscoConfig();
61-
String hash = deployService.deployEvidence(fiscoConfig, groupId, DataFrom.COMMAND);
61+
FiscoConfig fiscoConfig = WeIdSdkUtils.loadNewFiscoConfig();
62+
String hash = contractService.deployEvidence(fiscoConfig, groupId, DataFrom.COMMAND);
6263
if (StringUtils.isNotBlank(hash)) {
6364
System.out.println("[DeployEvidence] the evidence deploy successfully, cns --> " + hash);
6465
System.exit(0);

0 commit comments

Comments
 (0)