Skip to content

Commit 8e1f818

Browse files
Merge 'feat/add_service_1209' into 'master'
feat.add servce 按组更新复合字段值 See merge request: !20
2 parents 385ec95 + 2361b7c commit 8e1f818

14 files changed

+595
-4
lines changed

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.21</version>
9+
<version>1.0.22</version>
1010
<build>
1111
<plugins>
1212
<plugin>

src/main/java/com/lark/project/core/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface Constants {
3030
String HTTP_HEADER_ACCESS_TOKEN = "X-PLUGIN-TOKEN";
3131

3232
String HTTP_HEADER_IDEM_UUID = "X-IDEM-UUID";
33-
String VERSION = "1.0.19";
33+
String VERSION = "1.0.22";
3434

3535
String BASE_URL = "https://project.feishu.cn";
3636

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
package com.lark.project.service.workitem;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.List;
6+
7+
public class WBSRelationChainEntityItem {
8+
9+
@SerializedName("project_key")
10+
private String projectKey;
11+
12+
13+
@SerializedName("work_item_type_key")
14+
private String workItemTypeKey;
15+
16+
@SerializedName("work_item_id")
17+
private Long workItemID;
18+
19+
@SerializedName("type")
20+
private String type;
21+
22+
@SerializedName("work_item_name")
23+
private String workItemName;
24+
25+
@SerializedName("state_key")
26+
private String stateKey;
27+
28+
@SerializedName("node_name")
29+
private String nodeName;
30+
31+
@SerializedName("sub_task_id")
32+
private Long subTaskID;
33+
34+
@SerializedName("sub_task_name")
35+
private String subTaskName;
36+
37+
@SerializedName("level")
38+
private Integer Level;
39+
40+
41+
public String getProjectKey() {
42+
return projectKey;
43+
}
44+
45+
public void setProjectKey(String projectKey) {
46+
this.projectKey = projectKey;
47+
}
48+
49+
public String getWorkItemTypeKey() {
50+
return workItemTypeKey;
51+
}
52+
53+
public void setWorkItemTypeKey(String workItemTypeKey) {
54+
this.workItemTypeKey = workItemTypeKey;
55+
}
56+
57+
public Long getWorkItemID() {
58+
return workItemID;
59+
}
60+
61+
public void setWorkItemID(Long workItemID) {
62+
this.workItemID = workItemID;
63+
}
64+
65+
public String getType() {
66+
return type;
67+
}
68+
69+
public void setType(String type) {
70+
this.type = type;
71+
}
72+
73+
public String getWorkItemName() {
74+
return workItemName;
75+
}
76+
77+
public void setWorkItemName(String workItemName) {
78+
this.workItemName = workItemName;
79+
}
80+
81+
public String getStateKey() {
82+
return stateKey;
83+
}
84+
85+
public void setStateKey(String stateKey) {
86+
this.stateKey = stateKey;
87+
}
88+
89+
public String getNodeName() {
90+
return nodeName;
91+
}
92+
93+
public void setNodeName(String nodeName) {
94+
this.nodeName = nodeName;
95+
}
96+
97+
public Long getSubTaskID() {
98+
return subTaskID;
99+
}
100+
101+
public void setSubTaskID(Long subTaskID) {
102+
this.subTaskID = subTaskID;
103+
}
104+
105+
public String getSubTaskName() {
106+
return subTaskName;
107+
}
108+
109+
public void setSubTaskName(String subTaskName) {
110+
this.subTaskName = subTaskName;
111+
}
112+
113+
public Integer getLevel() {
114+
return Level;
115+
}
116+
117+
public void setLevel(Integer level) {
118+
Level = level;
119+
}
120+
}

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,22 @@ public interface WorkItemService {
9999
// 更新实际工时
100100
public UpdateWorkingHourRecordResp updateWorkingHourRecord(UpdateWorkingHourRecordReq req, RequestOptions reqOptions) throws Exception;
101101

102-
// 获取工作流详情(wbs)
102+
/**
103+
* 获取工作流详情(WBS)。
104+
*
105+
* <p>对应 OpenAPI:{@code GET /open_api/:project_key/work_item/:work_item_type_key/:work_item_id/wbs_view}。</p>
106+
*
107+
* <p>请求中可通过 {@code need_union_deliverable} 和 {@code need_schedule_table_agg}
108+
* 参数控制返回是否包含融合交付物以及计划表自定义列聚合字段。</p>
109+
*/
103110
public WbsViewResp wbsView(WbsViewReq req, RequestOptions reqOptions) throws Exception;
104111

112+
/**
113+
* 按组更新复合字段值。
114+
*
115+
* <p>对应 OpenAPI:{@code POST /open_api/work_item/field_value/update_compound_field},
116+
* 支持对指定工作项的复合字段按组执行删除(delete)、更新(update)或添加(add)操作。</p>
117+
*/
118+
public UpdateCompoundFieldValueResp updateCompoundFieldValue(UpdateCompoundFieldValueReq req, RequestOptions reqOptions) throws Exception;
119+
105120
}

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,26 @@ public WbsViewResp wbsView(WbsViewReq req, RequestOptions reqOptions) throws Exc
658658
return resp;
659659
}
660660

661+
// 增量更新复合字段
662+
public UpdateCompoundFieldValueResp updateCompoundFieldValue(UpdateCompoundFieldValueReq req, RequestOptions reqOptions) throws Exception {
663+
if (reqOptions == null) {
664+
reqOptions = new RequestOptions();
665+
}
666+
667+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
668+
, "/open_api/work_item/field_value/update_compound_field"
669+
, false
670+
, req);
671+
672+
UpdateCompoundFieldValueResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, UpdateCompoundFieldValueResp.class);
673+
if (resp == null) {
674+
log.error(Logs.formatReq(req, httpResponse, "/open_api/work_item/field_value/update_compound_field"));
675+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
676+
}
677+
678+
resp.setRawResponse(httpResponse);
679+
resp.setRequest(req);
680+
681+
return resp;
682+
}
661683
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.lark.project.core.annotation.Body;
4+
import com.lark.project.service.field.model.FieldValuePair;
5+
import com.lark.project.service.workitem.model.Expand;
6+
7+
import java.util.List;
8+
9+
/**
10+
* 按组更新复合字段值的请求对象。
11+
*
12+
* <p>对应 OpenAPI:{@code POST /open_api/work_item/field_value/update_compound_field},
13+
* 用于对指定工作项的复合字段按组执行删除(delete)、更新(update)或添加(add)操作。</p>
14+
*/
15+
public class UpdateCompoundFieldValueReq {
16+
@Body
17+
private UpdateCompoundFieldValueReqBody body;
18+
19+
public UpdateCompoundFieldValueReq() {
20+
}
21+
22+
public UpdateCompoundFieldValueReq(UpdateCompoundFieldValueReq.Builder builder) {
23+
this.body = builder.body;
24+
}
25+
26+
public static Builder newBuilder() {
27+
return new Builder();
28+
}
29+
30+
public UpdateCompoundFieldValueReqBody getBody() {
31+
return body;
32+
}
33+
34+
public void setBody(UpdateCompoundFieldValueReqBody body) {
35+
this.body = body;
36+
}
37+
38+
public static class Builder {
39+
private UpdateCompoundFieldValueReqBody body;
40+
41+
public Builder() {
42+
body = new UpdateCompoundFieldValueReqBody();
43+
}
44+
45+
public UpdateCompoundFieldValueReq.Builder workItemID(Long workItemID) {
46+
this.body.setWorkItemID(workItemID);
47+
return this;
48+
}
49+
50+
public UpdateCompoundFieldValueReq.Builder projectKey(String projectKey) {
51+
this.body.setProjectKey(projectKey);
52+
return this;
53+
}
54+
55+
public UpdateCompoundFieldValueReq.Builder fieldKey(String fieldKey) {
56+
this.body.setFieldKey(fieldKey);
57+
return this;
58+
}
59+
60+
public UpdateCompoundFieldValueReq.Builder fieldAlias(String fieldAlias) {
61+
this.body.setFieldAlias(fieldAlias);
62+
return this;
63+
}
64+
65+
public UpdateCompoundFieldValueReq.Builder groupUUID(String groupUUID) {
66+
this.body.setGroupUUID(groupUUID);
67+
return this;
68+
}
69+
70+
public UpdateCompoundFieldValueReq.Builder action(String action) {
71+
this.body.setAction(action);
72+
return this;
73+
}
74+
75+
public UpdateCompoundFieldValueReq.Builder fields(List<List<FieldValuePair>> fields) {
76+
this.body.setFields(fields);
77+
return this;
78+
}
79+
80+
public UpdateCompoundFieldValueReq build() {
81+
return new UpdateCompoundFieldValueReq(this);
82+
}
83+
}
84+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import com.lark.project.service.field.model.FieldValuePair;
5+
6+
import java.util.List;
7+
8+
public class UpdateCompoundFieldValueReqBody {
9+
10+
@SerializedName("work_item_id")
11+
private Long WorkItemID;
12+
13+
@SerializedName("project_key")
14+
private String ProjectKey;
15+
16+
@SerializedName("field_key")
17+
private String FieldKey;
18+
19+
@SerializedName("field_alias")
20+
private String FieldAlias;
21+
22+
@SerializedName("group_uuid")
23+
private String GroupUUID;
24+
25+
@SerializedName("action")
26+
private String Action;
27+
28+
@SerializedName("fields")
29+
private List<List<FieldValuePair>> Fields;
30+
31+
public Long getWorkItemID() {
32+
return WorkItemID;
33+
}
34+
35+
public void setWorkItemID(Long workItemID) {
36+
WorkItemID = workItemID;
37+
}
38+
39+
public String getProjectKey() {
40+
return ProjectKey;
41+
}
42+
43+
public void setProjectKey(String projectKey) {
44+
ProjectKey = projectKey;
45+
}
46+
47+
public String getFieldKey() {
48+
return FieldKey;
49+
}
50+
51+
public void setFieldKey(String fieldKey) {
52+
FieldKey = fieldKey;
53+
}
54+
55+
public String getFieldAlias() {
56+
return FieldAlias;
57+
}
58+
59+
public void setFieldAlias(String fieldAlias) {
60+
FieldAlias = fieldAlias;
61+
}
62+
63+
public String getGroupUUID() {
64+
return GroupUUID;
65+
}
66+
67+
public void setGroupUUID(String groupUUID) {
68+
GroupUUID = groupUUID;
69+
}
70+
71+
public String getAction() {
72+
return Action;
73+
}
74+
75+
public void setAction(String action) {
76+
Action = action;
77+
}
78+
79+
public List<List<FieldValuePair>> getFields() {
80+
return Fields;
81+
}
82+
83+
public void setFields(List<List<FieldValuePair>> fields) {
84+
Fields = fields;
85+
}
86+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.lark.project.core.response.BaseResponse;
4+
5+
/**
6+
* 按组更新复合字段值的响应对象。
7+
*
8+
* <p>对应 OpenAPI:{@code POST /open_api/work_item/field_value/update_compound_field},
9+
* 返回请求是否执行成功以及错误码信息。</p>
10+
*/
11+
public class UpdateCompoundFieldValueResp extends BaseResponse {
12+
}

0 commit comments

Comments
 (0)