55import lombok .RequiredArgsConstructor ;
66import lombok .extern .slf4j .Slf4j ;
77import org .apache .commons .lang3 .StringUtils ;
8+ import org .apache .commons .lang3 .tuple .Pair ;
89import org .lowcoder .api .application .view .ApplicationInfoView ;
910import org .lowcoder .api .application .view .ApplicationView ;
1011import org .lowcoder .api .home .SessionUserService ;
1112import org .lowcoder .api .usermanagement .view .AddMemberRequest ;
1213import org .lowcoder .api .usermanagement .view .UpdateRoleRequest ;
14+ import org .lowcoder .domain .application .service .ApplicationRecordServiceImpl ;
1315import org .lowcoder .domain .application .service .ApplicationService ;
1416import org .lowcoder .domain .datasource .model .Datasource ;
1517import org .lowcoder .domain .datasource .service .DatasourceService ;
4042import org .lowcoder .infra .event .groupmember .GroupMemberRoleUpdateEvent ;
4143import org .lowcoder .infra .event .user .UserLoginEvent ;
4244import org .lowcoder .infra .event .user .UserLogoutEvent ;
45+ import org .lowcoder .infra .util .TupleUtils ;
4346import org .lowcoder .plugin .api .event .LowcoderEvent .EventType ;
4447import org .lowcoder .sdk .constants .Authentication ;
4548import org .lowcoder .sdk .util .LocaleUtils ;
@@ -65,6 +68,7 @@ public class BusinessEventPublisher {
6568 private final ApplicationService applicationService ;
6669 private final DatasourceService datasourceService ;
6770 private final ResourcePermissionService resourcePermissionService ;
71+ private final ApplicationRecordServiceImpl applicationRecordServiceImpl ;
6872
6973 public Mono <Void > publishFolderCommonEvent (String folderId , String folderName , EventType eventType ) {
7074
@@ -126,17 +130,32 @@ public Mono<Void> publishApplicationCommonEvent(ApplicationView applicationView,
126130 .onErrorReturn (Optional .empty ());
127131 }))
128132 .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 )
129144 .doOnNext (tuple -> {
130145 OrgMember orgMember = tuple .getT1 ().getT1 ();
131146 Optional <Folder > optional = tuple .getT1 ().getT2 ();
132147 String token = tuple .getT2 ();
148+ String category = tuple .getT3 ().getLeft ();
149+ String description = tuple .getT3 ().getRight ();
133150 ApplicationInfoView applicationInfoView = applicationView .getApplicationInfoView ();
134151 ApplicationCommonEvent event = ApplicationCommonEvent .builder ()
135152 .orgId (orgMember .getOrgId ())
136153 .userId (orgMember .getUserId ())
137154 .applicationId (applicationInfoView .getApplicationId ())
138155 .applicationGid (applicationInfoView .getApplicationGid ())
139156 .applicationName (applicationInfoView .getName ())
157+ .applicationCategory (category )
158+ .applicationDescription (description )
140159 .type (eventType )
141160 .folderId (optional .map (Folder ::getId ).orElse (null ))
142161 .folderName (optional .map (Folder ::getName ).orElse (null ))
0 commit comments