@@ -92,7 +92,7 @@ public class ApplicationApiServiceImpl implements ApplicationApiService {
92
92
private final OrgDevChecker orgDevChecker ;
93
93
private final TemplateSolutionService templateSolutionService ;
94
94
private final SuggestAppAdminSolutionService suggestAppAdminSolutionService ;
95
-
95
+
96
96
private final FolderApiService folderApiService ;
97
97
private final UserHomeApiService userHomeApiService ;
98
98
private final UserApplicationInteractionService userApplicationInteractionService ;
@@ -240,8 +240,8 @@ private Mono<Void> checkApplicationViewRequest(Application application, Applicat
240
240
if (expected == ApplicationRequestType .PUBLIC_TO_MARKETPLACE && application .isPublicToMarketplace () && application .isPublicToAll ()) {
241
241
return Mono .empty ();
242
242
}
243
-
244
- //
243
+
244
+ //
245
245
// Falk: application.agencyProfile() & isPublicToAll must be both true
246
246
if (expected == ApplicationRequestType .AGENCY_PROFILE && application .agencyProfile () && application .isPublicToAll ()) {
247
247
return Mono .empty ();
@@ -560,9 +560,9 @@ public Mono<ResourcePermission> checkApplicationPermissionWithReadableErrorMsg(S
560
560
return Mono .just (permissionStatus .getPermission ());
561
561
});
562
562
}
563
-
564
-
565
-
563
+
564
+
565
+
566
566
private Mono <ApplicationInfoView > buildView (Application application , String role ) {
567
567
return buildView (application , role , null ).delayUntil (applicationInfoView -> {
568
568
String applicationId = applicationInfoView .getApplicationId ();
@@ -574,32 +574,47 @@ private Mono<ApplicationInfoView> buildView(Application application, String role
574
574
}
575
575
576
576
private Mono <ApplicationInfoView > buildView (Application application , String role , @ Nullable String folderId ) {
577
- return application .getCategory (applicationRecordService )
578
- .zipWith (application .getDescription (applicationRecordService ))
579
- .zipWith (application .getTitle (applicationRecordService ), TupleUtils ::merge )
580
- .map (tuple ->
581
- ApplicationInfoView .builder ()
582
- .applicationId (application .getId ())
583
- .applicationGid (application .getGid ())
584
- .orgId (application .getOrganizationId ())
585
- .name (application .getName ())
586
- .createBy (application .getCreatedBy ())
587
- .createAt (application .getCreatedAt ().toEpochMilli ())
588
- .role (role )
589
- .applicationType (application .getApplicationType ())
590
- .applicationStatus (application .getApplicationStatus ())
591
- .folderId (folderId )
592
- .publicToAll (application .isPublicToAll ())
593
- .publicToMarketplace (application .isPublicToMarketplace ())
594
- .agencyProfile (application .agencyProfile ())
595
- .editingUserId (application .getEditingUserId ())
596
- .lastModifyTime (application .getUpdatedAt ())
597
- .lastEditedAt (application .getLastEditedAt ())
598
- .category (tuple .getT1 ())
599
- .description (tuple .getT2 ())
600
- .title (tuple .getT3 ())
601
- .build ()
602
- );
577
+ Mono <String > categoryMono = application .getCategory (applicationRecordService );
578
+ Mono <String > descriptionMono = application .getDescription (applicationRecordService );
579
+ Mono <ApplicationVersion > latestRecordMono = applicationRecordService
580
+ .getLatestRecordByApplicationId (application .getId ())
581
+ .defaultIfEmpty (new ApplicationVersion () );
582
+ Mono <String > titleMono = application .getTitle (applicationRecordService );
583
+
584
+ return Mono .zip (categoryMono , descriptionMono , latestRecordMono , titleMono )
585
+ .map (tuple -> {
586
+ String category = tuple .getT1 ();
587
+ String description = tuple .getT2 ();
588
+ ApplicationVersion latestRecord = tuple .getT3 ();
589
+ String title = tuple .getT4 ();
590
+ boolean hasPublished = latestRecord .getTag () != null && !latestRecord .getTag ().isEmpty ();
591
+ return ApplicationInfoView .builder ()
592
+ .category (category )
593
+ .description (description )
594
+ .published (hasPublished )
595
+ .publishedVersion (hasPublished ? latestRecord .getTag () : null )
596
+ .lastPublishedTime (hasPublished && latestRecord .getCreateTime () != 0
597
+ ? Instant .ofEpochMilli (latestRecord .getCreateTime ())
598
+ : null )
599
+ .title (title )
600
+ .applicationId (application .getId ())
601
+ .applicationGid (application .getGid ())
602
+ .orgId (application .getOrganizationId ())
603
+ .name (application .getName ())
604
+ .createBy (application .getCreatedBy ())
605
+ .createAt (application .getCreatedAt ().toEpochMilli ())
606
+ .role (role )
607
+ .applicationType (application .getApplicationType ())
608
+ .applicationStatus (application .getApplicationStatus ())
609
+ .folderId (folderId )
610
+ .publicToAll (application .isPublicToAll ())
611
+ .publicToMarketplace (application .isPublicToMarketplace ())
612
+ .agencyProfile (application .agencyProfile ())
613
+ .editingUserId (application .getEditingUserId ())
614
+ .lastModifyTime (application .getUpdatedAt ())
615
+ .lastEditedAt (application .getLastEditedAt ())
616
+ .build ();
617
+ });
603
618
}
604
619
605
620
private Mono <ApplicationInfoView > buildView (Application application ) {
0 commit comments