Skip to content

Commit d6300c9

Browse files
Merge branch 'feature/repair_third_week' of code.byted.org:bits/project-oapi-sdk-java into feature/repair_third_week
2 parents eaa6d41 + 739327e commit d6300c9

34 files changed

+1159
-9
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ target/
3030

3131
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
3232
hs_err_pid*
33+
34+
src/main/resources/开发者手册/*
35+
src/main/java/com/lark/project/sample/*

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.larksuite.project</groupId>
88
<artifactId>oapi-sdk</artifactId>
9-
<version>1.0.24</version>
9+
<version>1.0.25</version>
1010
<build>
1111
<plugins>
1212
<plugin>

src/main/java/com/lark/project/service/field/builder/UpdateFieldReq.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.gson.annotations.SerializedName;
2020
import com.lark.project.core.annotation.Body;
2121
import com.lark.project.core.annotation.Path;
22+
import com.lark.project.service.field.model.TeamOption;
2223
import com.lark.project.service.field.model.FieldValue;
2324

2425
import java.util.List;
@@ -136,6 +137,16 @@ public Builder authorizedRoles(List<String> authorizedRoles) {
136137
return this;
137138
}
138139

140+
public Builder teamOption(TeamOption teamOption) {
141+
this.body.setTeamOption(teamOption);
142+
return this;
143+
}
144+
145+
public Builder numberConfig(UpdateFieldReqBody.NumberConfig numberConfig) {
146+
this.body.setNumberConfig(numberConfig);
147+
return this;
148+
}
149+
139150
public UpdateFieldReq build() {
140151
return new UpdateFieldReq(this);
141152
}

src/main/java/com/lark/project/service/field/builder/UpdateFieldReqBody.java

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.lark.project.service.field.builder;
1818

1919
import com.google.gson.annotations.SerializedName;
20-
import com.lark.project.service.field.model.FieldValue;
20+
import com.lark.project.service.field.model.TeamOption;
2121

2222
import java.util.List;
2323

@@ -41,6 +41,10 @@ public class UpdateFieldReqBody {
4141
private String helpDescription;
4242
@SerializedName("authorized_roles")
4343
private List<String> authorizedRoles;
44+
@SerializedName("number_config")
45+
private NumberConfig numberConfig;
46+
@SerializedName("team_option")
47+
private TeamOption teamOption;
4448

4549
public String getFieldName() {
4650
return this.fieldName;
@@ -113,4 +117,86 @@ public List<String> getAuthorizedRoles() {
113117
public void setAuthorizedRoles(List<String> authorizedRoles) {
114118
this.authorizedRoles = authorizedRoles;
115119
}
120+
121+
public TeamOption getTeamOption() {
122+
return this.teamOption;
123+
}
124+
125+
public void setTeamOption(TeamOption teamOption) {
126+
this.teamOption = teamOption;
127+
}
128+
129+
public NumberConfig getNumberConfig() {
130+
return this.numberConfig;
131+
}
132+
133+
public void setNumberConfig(NumberConfig numberConfig) {
134+
this.numberConfig = numberConfig;
135+
}
136+
137+
public static class NumberConfig {
138+
@SerializedName("scaling_ratio")
139+
private String scalingRatio;
140+
@SerializedName("display_digits")
141+
private Integer displayDigits;
142+
@SerializedName("symbol_setting")
143+
private SymbolSetting symbolSetting;
144+
145+
public String getScalingRatio() {
146+
return scalingRatio;
147+
}
148+
149+
public void setScalingRatio(String scalingRatio) {
150+
this.scalingRatio = scalingRatio;
151+
}
152+
153+
public Integer getDisplayDigits() {
154+
return displayDigits;
155+
}
156+
157+
public void setDisplayDigits(Integer displayDigits) {
158+
this.displayDigits = displayDigits;
159+
}
160+
161+
public SymbolSetting getSymbolSetting() {
162+
return symbolSetting;
163+
}
164+
165+
public void setSymbolSetting(SymbolSetting symbolSetting) {
166+
this.symbolSetting = symbolSetting;
167+
}
168+
}
169+
170+
public static class SymbolSetting {
171+
@SerializedName("display")
172+
private String display;
173+
@SerializedName("value")
174+
private String value;
175+
@SerializedName("layout")
176+
private String layout;
177+
178+
public String getDisplay() {
179+
return display;
180+
}
181+
182+
public void setDisplay(String display) {
183+
this.display = display;
184+
}
185+
186+
public String getValue() {
187+
return value;
188+
}
189+
190+
public void setValue(String value) {
191+
this.value = value;
192+
}
193+
194+
public String getLayout() {
195+
return layout;
196+
}
197+
198+
public void setLayout(String layout) {
199+
this.layout = layout;
200+
}
201+
}
116202
}

src/main/java/com/lark/project/service/workitem/WorkItemService.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ public interface WorkItemService {
102102
// 更新实际工时
103103
public UpdateWorkingHourRecordResp updateWorkingHourRecord(UpdateWorkingHourRecordReq req, RequestOptions reqOptions) throws Exception;
104104

105+
// 拉机器人入群
106+
public BotJoinChatResp botJoinChat(BotJoinChatReq req, RequestOptions reqOptions) throws Exception;
107+
105108
/**
106109
* 获取工作流详情(WBS)。
107110
*
@@ -123,14 +126,35 @@ public interface WorkItemService {
123126
/**
124127
* 批量更新工作项。
125128
*
126-
* <p>对应 OpenAPI:{@code POST /open_api/:project_key/work_item/:work_item_type_key/batch_update}</p>
129+
* <p>对应 OpenAPI:{@code POST /open_api/work_item/batch_update}</p>
127130
*/
128131
public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, RequestOptions reqOptions) throws Exception;
129132

130133
/**
131134
* 获取任务结果。
132135
*
133-
* <p>对应 OpenAPI:{@code GET /open_api/:project_key/work_item/:work_item_type_key/:work_item_id/task_result}</p>
136+
* <p>对应 OpenAPI:{@code GET /open_api/task_result}</p>
134137
*/
135138
public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqOptions) throws Exception;
139+
140+
/**
141+
* 交付物信息批量查询(WBS)
142+
*
143+
* <p>对应 OpenAPI:{@code POST /open_api/work_item/deliverable/batch_query}</p>
144+
*/
145+
public BatchQueryDeliverableResp batchQueryDeliverable(BatchQueryDeliverableReq req, RequestOptions reqOptions) throws Exception;
146+
147+
/**
148+
* 冻结/解冻工作项
149+
*
150+
* <p>对应 OpenAPI:{@code PUT /open_api/work_item/freeze}</p>
151+
*/
152+
public FreezeWorkItemResp freezeWorkItem(FreezeWorkItemReq req, RequestOptions reqOptions) throws Exception;
153+
154+
/**
155+
* 获取工作项操作记录
156+
*
157+
* <p>对应 OpenAPI:{@code POST /open_api/op_record/work_item/list}</p>
158+
*/
159+
public ListWorkItemOpRecordResp listWorkItemOpRecord(ListWorkItemOpRecordReq req, RequestOptions reqOptions) throws Exception;
136160
}

src/main/java/com/lark/project/service/workitem/WorkItemServiceImpl.java

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ public UpdateCompoundFieldValueResp updateCompoundFieldValue(UpdateCompoundField
704704
return resp;
705705
}
706706

707-
@Override
707+
// 批量更新工作项。
708708
public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, RequestOptions reqOptions) throws Exception {
709709
if (reqOptions == null) {
710710
reqOptions = new RequestOptions();
@@ -727,7 +727,11 @@ public BatchUpdateWorkItemResp batchUpdateWorkItem(BatchUpdateWorkItemReq req, R
727727
return resp;
728728
}
729729

730-
@Override
730+
/**
731+
* 获取任务结果。
732+
*
733+
* <p>对应 OpenAPI:{@code GET /open_api/task_result}</p>
734+
*/
731735
public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqOptions) throws Exception {
732736
if (reqOptions == null) {
733737
reqOptions = new RequestOptions();
@@ -749,4 +753,96 @@ public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqO
749753

750754
return resp;
751755
}
756+
757+
// 拉机器人入群
758+
public BotJoinChatResp botJoinChat(BotJoinChatReq req, RequestOptions reqOptions) throws Exception {
759+
if (reqOptions == null) {
760+
reqOptions = new RequestOptions();
761+
}
762+
763+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
764+
, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"
765+
, false
766+
, req);
767+
768+
BotJoinChatResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, BotJoinChatResp.class);
769+
if (resp == null) {
770+
log.error(Logs.formatReq(req, httpResponse, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"));
771+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
772+
}
773+
774+
resp.setRawResponse(httpResponse);
775+
resp.setRequest(req);
776+
777+
return resp;
778+
}
779+
780+
// 交付物信息批量查询(WBS)
781+
public BatchQueryDeliverableResp batchQueryDeliverable(BatchQueryDeliverableReq req, RequestOptions reqOptions) throws Exception {
782+
if (reqOptions == null) {
783+
reqOptions = new RequestOptions();
784+
}
785+
786+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
787+
, "/open_api/work_item/deliverable/batch_query"
788+
, false
789+
, req);
790+
791+
BatchQueryDeliverableResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, BatchQueryDeliverableResp.class);
792+
if (resp == null) {
793+
log.error(Logs.formatReq(req, httpResponse, "/open_api/work_item/deliverable/batch_query"));
794+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
795+
}
796+
797+
resp.setRawResponse(httpResponse);
798+
resp.setRequest(req);
799+
800+
return resp;
801+
}
802+
803+
// 冻结/解冻工作项
804+
public FreezeWorkItemResp freezeWorkItem(FreezeWorkItemReq req, RequestOptions reqOptions) throws Exception {
805+
if (reqOptions == null) {
806+
reqOptions = new RequestOptions();
807+
}
808+
809+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "PUT"
810+
, "/open_api/work_item/freeze"
811+
, false
812+
, req);
813+
814+
FreezeWorkItemResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, FreezeWorkItemResp.class);
815+
if (resp == null) {
816+
log.error(Logs.formatReq(req, httpResponse, "/open_api/work_item/freeze"));
817+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
818+
}
819+
820+
resp.setRawResponse(httpResponse);
821+
resp.setRequest(req);
822+
823+
return resp;
824+
}
825+
826+
// 获取工作项操作记录
827+
public ListWorkItemOpRecordResp listWorkItemOpRecord(ListWorkItemOpRecordReq req, RequestOptions reqOptions) throws Exception {
828+
if (reqOptions == null) {
829+
reqOptions = new RequestOptions();
830+
}
831+
832+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
833+
, "/open_api/op_record/work_item/list"
834+
, false
835+
, req);
836+
837+
ListWorkItemOpRecordResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, ListWorkItemOpRecordResp.class);
838+
if (resp == null) {
839+
log.error(Logs.formatReq(req, httpResponse, "/open_api/op_record/work_item/list"));
840+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
841+
}
842+
843+
resp.setRawResponse(httpResponse);
844+
resp.setRequest(req);
845+
846+
return resp;
847+
}
752848
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.lark.project.core.annotation.Body;
4+
import java.util.List;
5+
6+
public class BatchQueryDeliverableReq {
7+
@Body
8+
private BatchQueryDeliverableReqBody body;
9+
10+
public BatchQueryDeliverableReq() {
11+
}
12+
13+
public BatchQueryDeliverableReq(Builder builder) {
14+
this.body = builder.body;
15+
}
16+
17+
public static Builder newBuilder() {
18+
return new Builder();
19+
}
20+
21+
public BatchQueryDeliverableReqBody getBatchQueryDeliverableReqBody() {
22+
return this.body;
23+
}
24+
25+
public void setBatchQueryDeliverableReqBody(BatchQueryDeliverableReqBody body) {
26+
this.body = body;
27+
}
28+
29+
public static class Builder {
30+
private BatchQueryDeliverableReqBody body;
31+
32+
public Builder() {
33+
body = new BatchQueryDeliverableReqBody();
34+
}
35+
36+
public Builder projectKey(String projectKey) {
37+
this.body.setProjectKey(projectKey);
38+
return this;
39+
}
40+
41+
public Builder workItemIds(List<Long> workItemIds) {
42+
this.body.setWorkItemIds(workItemIds);
43+
return this;
44+
}
45+
46+
public BatchQueryDeliverableReq build() {
47+
return new BatchQueryDeliverableReq(this);
48+
}
49+
}
50+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import java.util.List;
5+
6+
public class BatchQueryDeliverableReqBody {
7+
@SerializedName("project_key")
8+
private String projectKey;
9+
@SerializedName("work_item_ids")
10+
private List<Long> workItemIds;
11+
12+
public String getProjectKey() { return projectKey; }
13+
public void setProjectKey(String projectKey) { this.projectKey = projectKey; }
14+
15+
public List<Long> getWorkItemIds() { return workItemIds; }
16+
public void setWorkItemIds(List<Long> workItemIds) { this.workItemIds = workItemIds; }
17+
}

0 commit comments

Comments
 (0)