Skip to content

Commit 55bacf0

Browse files
authored
Merge pull request #221 from youwenbusi/develop
1.3.1 firstly commit
2 parents 48f7829 + 6102c05 commit 55bacf0

File tree

6 files changed

+15
-31
lines changed

6 files changed

+15
-31
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0-rc1
1+
1.3.1-rc1-SNAPSHOT

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ repositories {
4646
mavenLocal()
4747
if ("cn" == repo) {
4848
println "use cn repo"
49-
// maven {url "http://maven.aliyun.com/nexus/content/groups/public/"}
49+
maven {url "http://maven.aliyun.com/nexus/content/groups/public/"}
5050
mavenCentral()
5151
} else {
5252
println "use default repo"
@@ -127,7 +127,6 @@ configurations {
127127
}
128128

129129
// In this section you declare the dependencies for your production and test code
130-
weidSdkVersion='1.8.5-rc1'
131130
dependencies {
132131
localDeps lombok
133132
compile('org.springframework.boot:spring-boot-starter-web')

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
2-
weidSdkVersion=1.8.5-rc1
2+
weidSdkVersion=1.8.6-rc.2-SNAPSHOT
33
repoType=cn
44
jdkTlsNamedGroups=secp256r1,secp256k1
55
signing.keyId=

src/main/java/com/webank/weid/controller/WeIdSdkController.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,13 @@ public ResponseData<DataPanel> getDataPanel() {
6060

6161
@GetMapping("/getWeIdList")
6262
public ResponseData<PageDto<WeIdInfo>> getWeIdList(
63-
@RequestParam(value = "blockNumber") int blockNumber,
6463
@RequestParam(value = "pageSize") int pageSize,
65-
@RequestParam(value = "indexInBlock") int indexInBlock,
66-
@RequestParam(value = "direction") boolean direction,
64+
@RequestParam(value = "indexFirst") int indexFirst,
6765
@RequestParam(value = "iDisplayStart") int iDisplayStart,
6866
@RequestParam(value = "iDisplayLength") int iDisplayLength
6967
) {
70-
if (blockNumber == 0) {
71-
try {
72-
blockNumber = BaseService.getBlockNumber();
73-
} catch (IOException e) {
74-
log.error("[getWeIdList] get blockNumber fail.", e);
75-
return new ResponseData<>(null, ErrorCode.BASE_ERROR);
76-
}
77-
}
7868
PageDto<WeIdInfo> pageDto = new PageDto<WeIdInfo>(iDisplayStart, iDisplayLength);
79-
return weIdSdkService.getWeIdList(pageDto, blockNumber, pageSize, indexInBlock, direction);
69+
return weIdSdkService.getWeIdList(pageDto, pageSize, indexFirst);
8070
}
8171

8272
@Description("查询issuer type列表")

src/main/java/com/webank/weid/dto/WeIdInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
package com.webank.weid.dto;
44

5-
import com.webank.weid.protocol.base.WeIdPojo;
5+
import com.webank.weid.protocol.base.WeIdDocumentMetadata;
66

77
import lombok.Data;
88
import lombok.EqualsAndHashCode;
@@ -17,7 +17,7 @@ public class WeIdInfo extends BaseDto {
1717
private boolean isIssuer;
1818
private String weIdShow;
1919
private boolean isAdmin;
20-
private WeIdPojo weIdPojo;
20+
//private WeIdDocumentMetadata weIdDocumentMetadata;
2121

2222
public void setWeId(String weId) {
2323
this.weId = weId;

src/main/java/com/webank/weid/service/WeIdSdkService.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.webank.weid.protocol.base.IssuerType;
2424
import com.webank.weid.protocol.base.PresentationPolicyE;
2525
import com.webank.weid.protocol.base.WeIdAuthentication;
26-
import com.webank.weid.protocol.base.WeIdPojo;
2726
import com.webank.weid.protocol.base.WeIdPrivateKey;
2827
import com.webank.weid.protocol.base.WeIdPublicKey;
2928
import com.webank.weid.protocol.request.CptStringArgs;
@@ -135,29 +134,26 @@ public ResponseData<DataPanel> getDataPanel() {
135134

136135
public ResponseData<PageDto<WeIdInfo>> getWeIdList(
137136
PageDto<WeIdInfo> pageDto,
138-
Integer blockNumber,
139137
Integer pageSize,
140-
Integer indexInBlock,
141-
boolean direction
138+
Integer indexFirst
142139
) {
143-
ResponseData<List<WeIdPojo>> response = getWeIdService().getWeIdList(blockNumber, pageSize, indexInBlock, direction);
140+
ResponseData<List<String>> response = getWeIdService().getWeIdList(indexFirst, indexFirst+pageSize-1);
144141
if (response.getErrorCode() != ErrorCode.SUCCESS.getCode()) {
145142
log.error("[getWeIdList] get weIdList has error, {} - {}", response.getErrorCode(), response.getErrorMessage());
146143
return new ResponseData<>(pageDto, response.getErrorCode(), response.getErrorMessage());
147144
}
148-
List<WeIdPojo> list = response.getResult();
145+
List<String> list = response.getResult();
149146
pageDto.setAllCount(getWeIdService().getWeIdCount().getResult());
150147
List<WeIdInfo> rList = new ArrayList<>();
151148
if (list.size() > 0) {
152149
String mainHash = WeIdSdkUtils.getMainHash();
153-
for (WeIdPojo weIdPojo : list) {
154-
WeIdInfo weInfo = getWeIdInfo(this.getWeIdAddress(weIdPojo.getId()));
150+
for (String weId : list) {
151+
WeIdInfo weInfo = getWeIdInfo(this.getWeIdAddress(weId));
155152
if(weInfo == null) {
156153
weInfo = new WeIdInfo();
157154
}
158-
weInfo.setWeIdPojo(weIdPojo);
159-
weInfo.setWeId(weIdPojo.getId());
160-
AuthorityIssuer issuer = getAuthorityIssuerService().queryAuthorityIssuerInfo(weIdPojo.getId()).getResult();
155+
weInfo.setWeId(weId);
156+
AuthorityIssuer issuer = getAuthorityIssuerService().queryAuthorityIssuerInfo(weId).getResult();
161157
weInfo.setIssuer(issuer != null);
162158
weInfo.setHash(mainHash);
163159
rList.add(weInfo);
@@ -274,7 +270,7 @@ public ResponseData<String> createWeIdByPublicKey(HttpServletRequest request, Da
274270
if (currentWeIdAuth.getWeId().equals(owner)) {
275271
WeIdPublicKey weidPublicKey = new WeIdPublicKey();
276272
weidPublicKey.setPublicKey(publicKey);
277-
ResponseData<String> response = getWeIdService().delegateCreateWeId(weidPublicKey, currentWeIdAuth);
273+
ResponseData<String> response = getWeIdService().createWeIdByPublicKey(weidPublicKey, currentWeIdAuth.getWeIdPrivateKey());
278274
if (!response.getErrorCode().equals(ErrorCode.SUCCESS.getCode())) {
279275
log.error(
280276
"[CreateWeId] create WeID faild. error code : {}, error msg :{}",
@@ -489,7 +485,6 @@ private WeIdAuthentication getCurrentWeIdAuth() {
489485
callerAuth.setWeIdPrivateKey(weIdPrivateKey);
490486
callerAuth.setWeId(WeIdUtils.convertPublicKeyToWeId(
491487
DataToolUtils.publicKeyFromPrivate(new BigInteger(weIdPrivateKey.getPrivateKey())).toString()));
492-
callerAuth.setWeIdPublicKeyId(callerAuth.getWeId());
493488
return callerAuth;
494489
}
495490

0 commit comments

Comments
 (0)