5
5
import lombok .RequiredArgsConstructor ;
6
6
import lombok .extern .slf4j .Slf4j ;
7
7
import org .apache .commons .lang3 .StringUtils ;
8
+ import org .apache .commons .lang3 .tuple .Pair ;
8
9
import org .lowcoder .api .application .view .ApplicationInfoView ;
9
10
import org .lowcoder .api .application .view .ApplicationView ;
10
11
import org .lowcoder .api .home .SessionUserService ;
11
12
import org .lowcoder .api .usermanagement .view .AddMemberRequest ;
12
13
import org .lowcoder .api .usermanagement .view .UpdateRoleRequest ;
14
+ import org .lowcoder .domain .application .service .ApplicationRecordServiceImpl ;
13
15
import org .lowcoder .domain .application .service .ApplicationService ;
14
16
import org .lowcoder .domain .datasource .model .Datasource ;
15
17
import org .lowcoder .domain .datasource .service .DatasourceService ;
40
42
import org .lowcoder .infra .event .groupmember .GroupMemberRoleUpdateEvent ;
41
43
import org .lowcoder .infra .event .user .UserLoginEvent ;
42
44
import org .lowcoder .infra .event .user .UserLogoutEvent ;
45
+ import org .lowcoder .infra .util .TupleUtils ;
43
46
import org .lowcoder .plugin .api .event .LowcoderEvent .EventType ;
44
47
import org .lowcoder .sdk .constants .Authentication ;
45
48
import org .lowcoder .sdk .util .LocaleUtils ;
@@ -65,6 +68,7 @@ public class BusinessEventPublisher {
65
68
private final ApplicationService applicationService ;
66
69
private final DatasourceService datasourceService ;
67
70
private final ResourcePermissionService resourcePermissionService ;
71
+ private final ApplicationRecordServiceImpl applicationRecordServiceImpl ;
68
72
69
73
public Mono <Void > publishFolderCommonEvent (String folderId , String folderName , EventType eventType ) {
70
74
@@ -126,17 +130,32 @@ public Mono<Void> publishApplicationCommonEvent(ApplicationView applicationView,
126
130
.onErrorReturn (Optional .empty ());
127
131
}))
128
132
.zipWith (sessionUserService .getVisitorToken ())
133
+ .zipWith (Mono .defer (() -> {
134
+ String appId = applicationView .getApplicationInfoView ().getApplicationId ();
135
+ return applicationService .findById (appId )
136
+ .zipWhen (application -> application .getCategory (applicationRecordServiceImpl ))
137
+ .zipWhen (application -> application .getT1 ().getDescription (applicationRecordServiceImpl ))
138
+ .map (tuple -> {
139
+ String category = tuple .getT1 ().getT2 ();
140
+ String description = tuple .getT2 ();
141
+ return Pair .of (category , description );
142
+ });
143
+ }), TupleUtils ::merge )
129
144
.doOnNext (tuple -> {
130
145
OrgMember orgMember = tuple .getT1 ().getT1 ();
131
146
Optional <Folder > optional = tuple .getT1 ().getT2 ();
132
147
String token = tuple .getT2 ();
148
+ String category = tuple .getT3 ().getLeft ();
149
+ String description = tuple .getT3 ().getRight ();
133
150
ApplicationInfoView applicationInfoView = applicationView .getApplicationInfoView ();
134
151
ApplicationCommonEvent event = ApplicationCommonEvent .builder ()
135
152
.orgId (orgMember .getOrgId ())
136
153
.userId (orgMember .getUserId ())
137
154
.applicationId (applicationInfoView .getApplicationId ())
138
155
.applicationGid (applicationInfoView .getApplicationGid ())
139
156
.applicationName (applicationInfoView .getName ())
157
+ .applicationCategory (category )
158
+ .applicationDescription (description )
140
159
.type (eventType )
141
160
.folderId (optional .map (Folder ::getId ).orElse (null ))
142
161
.folderName (optional .map (Folder ::getName ).orElse (null ))
0 commit comments