Skip to content

Commit c7e4096

Browse files
修复
1 parent 0993040 commit c7e4096

File tree

6 files changed

+232
-0
lines changed

6 files changed

+232
-0
lines changed

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,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
*

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,4 +749,27 @@ public GetTaskResultResp getTaskResult(GetTaskResultReq req, RequestOptions reqO
749749

750750
return resp;
751751
}
752+
753+
// 拉机器人入群
754+
public BotJoinChatResp botJoinChat(BotJoinChatReq req, RequestOptions reqOptions) throws Exception {
755+
if (reqOptions == null) {
756+
reqOptions = new RequestOptions();
757+
}
758+
759+
RawResponse httpResponse = Transport.doSend(config, reqOptions, "POST"
760+
, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"
761+
, false
762+
, req);
763+
764+
BotJoinChatResp resp = UnmarshalRespUtil.unmarshalResp(httpResponse, BotJoinChatResp.class);
765+
if (resp == null) {
766+
log.error(Logs.formatReq(req, httpResponse, "/open_api/:project_key/work_item/:work_item_id/bot_join_chat"));
767+
throw new IllegalArgumentException(ErrConstants.RESULT_ILLEGAL);
768+
}
769+
770+
resp.setRawResponse(httpResponse);
771+
resp.setRequest(req);
772+
773+
return resp;
774+
}
752775
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import com.lark.project.core.annotation.Body;
5+
import com.lark.project.core.annotation.Path;
6+
7+
import java.util.List;
8+
9+
public class BotJoinChatReq {
10+
11+
@Path
12+
@SerializedName("project_key")
13+
private String projectKey;
14+
15+
@Path
16+
@SerializedName("work_item_id")
17+
private Long workItemID;
18+
19+
@Body
20+
private BotJoinChatReqBody body;
21+
22+
public BotJoinChatReq() {
23+
}
24+
25+
public BotJoinChatReq(Builder builder) {
26+
this.projectKey = builder.projectKey;
27+
this.workItemID = builder.workItemID;
28+
this.body = builder.body;
29+
}
30+
31+
public static Builder newBuilder() {
32+
return new Builder();
33+
}
34+
35+
public String getProjectKey() {
36+
return projectKey;
37+
}
38+
39+
public void setProjectKey(String projectKey) {
40+
this.projectKey = projectKey;
41+
}
42+
43+
public Long getWorkItemID() {
44+
return workItemID;
45+
}
46+
47+
public void setWorkItemID(Long workItemID) {
48+
this.workItemID = workItemID;
49+
}
50+
51+
public BotJoinChatReqBody getBotJoinChatReqBody() {
52+
return body;
53+
}
54+
55+
public void setBotJoinChatReqBody(BotJoinChatReqBody body) {
56+
this.body = body;
57+
}
58+
59+
public static class Builder {
60+
private String projectKey;
61+
private Long workItemID;
62+
private BotJoinChatReqBody body;
63+
64+
public Builder() {
65+
body = new BotJoinChatReqBody();
66+
}
67+
68+
public Builder projectKey(String projectKey) {
69+
this.projectKey = projectKey;
70+
return this;
71+
}
72+
73+
public Builder workItemID(Long workItemID) {
74+
this.workItemID = workItemID;
75+
return this;
76+
}
77+
78+
public Builder workItemTypeKey(String workItemTypeKey) {
79+
this.body.setWorkItemTypeKey(workItemTypeKey);
80+
return this;
81+
}
82+
83+
public Builder appIds(List<String> appIds) {
84+
this.body.setAppIds(appIds);
85+
return this;
86+
}
87+
88+
public BotJoinChatReq build() {
89+
return new BotJoinChatReq(this);
90+
}
91+
}
92+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.List;
6+
7+
public class BotJoinChatReqBody {
8+
9+
@SerializedName("work_item_type_key")
10+
private String workItemTypeKey;
11+
12+
@SerializedName("app_ids")
13+
private List<String> appIds;
14+
15+
public String getWorkItemTypeKey() {
16+
return workItemTypeKey;
17+
}
18+
19+
public void setWorkItemTypeKey(String workItemTypeKey) {
20+
this.workItemTypeKey = workItemTypeKey;
21+
}
22+
23+
public List<String> getAppIds() {
24+
return appIds;
25+
}
26+
27+
public void setAppIds(List<String> appIds) {
28+
this.appIds = appIds;
29+
}
30+
31+
public static Builder newBuilder() {
32+
return new Builder();
33+
}
34+
35+
public static class Builder {
36+
private String workItemTypeKey;
37+
private List<String> appIds;
38+
39+
public Builder workItemTypeKey(String workItemTypeKey) {
40+
this.workItemTypeKey = workItemTypeKey;
41+
return this;
42+
}
43+
44+
public Builder appIds(List<String> appIds) {
45+
this.appIds = appIds;
46+
return this;
47+
}
48+
49+
public BotJoinChatReqBody build() {
50+
BotJoinChatReqBody body = new BotJoinChatReqBody();
51+
body.setWorkItemTypeKey(workItemTypeKey);
52+
body.setAppIds(appIds);
53+
return body;
54+
}
55+
}
56+
}
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 com.lark.project.core.response.BaseResponse;
5+
6+
public class BotJoinChatResp extends BaseResponse {
7+
@SerializedName("data")
8+
private BotJoinChatRespBody data;
9+
10+
public BotJoinChatRespBody getData() {
11+
return this.data;
12+
}
13+
14+
public void setData(BotJoinChatRespBody data) {
15+
this.data = data;
16+
}
17+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.lark.project.service.workitem.builder;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
import java.util.List;
6+
7+
public class BotJoinChatRespBody {
8+
9+
@SerializedName("chat_id")
10+
private String chatId;
11+
12+
@SerializedName("failed_members")
13+
private List<String> failedMembers;
14+
15+
@SerializedName("success_members")
16+
private List<String> successMembers;
17+
18+
public String getChatId() {
19+
return chatId;
20+
}
21+
22+
public void setChatId(String chatId) {
23+
this.chatId = chatId;
24+
}
25+
26+
public List<String> getFailedMembers() {
27+
return failedMembers;
28+
}
29+
30+
public void setFailedMembers(List<String> failedMembers) {
31+
this.failedMembers = failedMembers;
32+
}
33+
34+
public List<String> getSuccessMembers() {
35+
return successMembers;
36+
}
37+
38+
public void setSuccessMembers(List<String> successMembers) {
39+
this.successMembers = successMembers;
40+
}
41+
}

0 commit comments

Comments
 (0)