Skip to content

Commit 626aad1

Browse files
committed
feat.add servce 按组更新复合字段值
1 parent 385ec95 commit 626aad1

13 files changed

+553
-2
lines changed

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.20";
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,7 @@ public interface WorkItemService {
102102
// 获取工作流详情(wbs)
103103
public WbsViewResp wbsView(WbsViewReq req, RequestOptions reqOptions) throws Exception;
104104

105+
//增量更新复合字段
106+
UpdateCompoundFieldValueResp updateCompoundFieldValue(UpdateCompoundFieldValueReq req, RequestOptions reqOptions) throws Exception;
107+
105108
}

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: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
public class UpdateCompoundFieldValueReq {
10+
@Body
11+
private UpdateCompoundFieldValueReqBody body;
12+
13+
public UpdateCompoundFieldValueReq() {
14+
}
15+
16+
public UpdateCompoundFieldValueReq(UpdateCompoundFieldValueReq.Builder builder) {
17+
this.body = builder.body;
18+
}
19+
20+
public static Builder newBuilder() {
21+
return new Builder();
22+
}
23+
24+
public UpdateCompoundFieldValueReqBody getBody() {
25+
return body;
26+
}
27+
28+
public void setBody(UpdateCompoundFieldValueReqBody body) {
29+
this.body = body;
30+
}
31+
32+
public static class Builder {
33+
private UpdateCompoundFieldValueReqBody body;
34+
35+
public Builder() {
36+
body = new UpdateCompoundFieldValueReqBody();
37+
}
38+
39+
public UpdateCompoundFieldValueReq.Builder workItemID(Long workItemID) {
40+
this.body.setWorkItemID(workItemID);
41+
return this;
42+
}
43+
44+
public UpdateCompoundFieldValueReq.Builder projectKey(String projectKey) {
45+
this.body.setProjectKey(projectKey);
46+
return this;
47+
}
48+
49+
public UpdateCompoundFieldValueReq.Builder fieldKey(String fieldKey) {
50+
this.body.setFieldKey(fieldKey);
51+
return this;
52+
}
53+
54+
public UpdateCompoundFieldValueReq.Builder fieldAlias(String fieldAlias) {
55+
this.body.setFieldAlias(fieldAlias);
56+
return this;
57+
}
58+
59+
public UpdateCompoundFieldValueReq.Builder groupUUID(String groupUUID) {
60+
this.body.setGroupUUID(groupUUID);
61+
return this;
62+
}
63+
64+
public UpdateCompoundFieldValueReq.Builder action(String action) {
65+
this.body.setAction(action);
66+
return this;
67+
}
68+
69+
public UpdateCompoundFieldValueReq.Builder fields(List<List<FieldValuePair>> fields) {
70+
this.body.setFields(fields);
71+
return this;
72+
}
73+
74+
public UpdateCompoundFieldValueReq build() {
75+
return new UpdateCompoundFieldValueReq(this);
76+
}
77+
}
78+
}
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.lark.project.core.response.BaseResponse;
4+
5+
public class UpdateCompoundFieldValueResp extends BaseResponse {
6+
}

0 commit comments

Comments
 (0)