Merged PR 190: Update Spring servlet max-size and fix dashboard bug

Update Spring servlet max-size and fix dashboard bug
This commit is contained in:
2025-07-02 15:40:38 +00:00
3 changed files with 41 additions and 28 deletions

View File

@@ -136,32 +136,43 @@ public class DashboardExecutionController {
@GetMapping("/users-by-projects") @GetMapping("/users-by-projects")
public ResponseEntity<List<User>> getUsersByProjects(@RequestParam String projectIdsArr) { public ResponseEntity<List<User>> getUsersByProjects(@RequestParam String projectIdsArr) {
try { try {
List<String> ids = Arrays.asList(projectIdsArr.split(",")); List<String> ids = Arrays.asList(projectIdsArr.split(","));
List<ObjectId> objectIds = ids.stream() List<ObjectId> objectIds = ids.stream()
.map(ObjectId::new) .map(ObjectId::new)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<User> users = dashboardUserRepository.findUsersByLstProjectsIn(objectIds); List<User> users = dashboardUserRepository.findUsersByLstProjectsIn(objectIds);
return ResponseEntity.ok(users); return ResponseEntity.ok(users);
} catch (Exception e) { } catch (Exception e) {
// Log dell'errore logger.error("Error fetching users by projects: ", e);
logger.error("Error fetching users by projects: ", e); return ResponseEntity.internalServerError().body(null);
return ResponseEntity.internalServerError().body(null);
} }
} }
@GetMapping("/scenarios-filter") @GetMapping("/scenarios-filter")
public ResponseEntity<List<Scenario>> getScenarios(@RequestParam String selectedAccount) { public ResponseEntity<List<Scenario>> getScenarios(@RequestParam String selectedAccount,
try { @RequestParam String dateFrom,
List<Scenario> scenarios = dashboardScenariosRepository.findAllForAccount(selectedAccount); @RequestParam String dateTo) {
return ResponseEntity.ok(scenarios);
} catch (Exception e) { try {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
Date fromDate = new SimpleDateFormat("yyyy-MM-dd").parse(dateFrom);
Date toDate = new SimpleDateFormat("yyyy-MM-dd").parse(dateTo);
List<String> scenarioIds = dashboardScenarioExecutionRepository.findDistinctScenarioIdsByDateAndAccount(fromDate, toDate, selectedAccount);
List<Scenario> scenarios = dashboardScenariosRepository.findAllById(scenarioIds);
return ResponseEntity.ok(scenarios);
} catch (Exception e) {
logger.error("Error getting scenarios: ", e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
} }
} }
@PostMapping("/dashboard-chat-stats") @PostMapping("/dashboard-chat-stats")
public ResponseEntity<List<DashboardResponse>> getChatStats (@RequestBody DashboardChatInput filters) { public ResponseEntity<List<DashboardResponse>> getChatStats (@RequestBody DashboardChatInput filters) {
try { try {

View File

@@ -1,11 +1,8 @@
package com.olympus.hermione.repository.dashboard; package com.olympus.hermione.repository.dashboard;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.bson.Document;
import org.springframework.data.mongodb.repository.Aggregation; import org.springframework.data.mongodb.repository.Aggregation;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query; import org.springframework.data.mongodb.repository.Query;
@@ -38,6 +35,14 @@ public interface DashboardScenarioExecutionRepository extends MongoRepository<Sc
@Query("{ 'lstProjects': { $in: ?0 }}") @Query("{ 'lstProjects': { $in: ?0 }}")
List<User> findUsersByLstProjectsIn(List<ObjectId> projectIds); List<User> findUsersByLstProjectsIn(List<ObjectId> projectIds);
@Aggregation(pipeline = {
"{ '$match': { 'startDate': { '$gte': ?0, '$lte': ?1 }, 'scenario.account': ?2, 'execSharedMap.user_input.selected_project': { '$in': ?3 } } }",
"{ '$group': { '_id': '$scenario._id' } }",
"{ '$project': { '_id': 0, 'scenarioId': '$_id' } }"
})
List<String> findDistinctScenarioIdsByDateAndAccount(Date dateFrom, Date dateTo, String account);
@Aggregation(pipeline = { @Aggregation(pipeline = {
"{ '$match': { " + "{ '$match': { " +
@@ -96,6 +101,4 @@ List<DashboardResponse> execStatsByFilters(
Date toDate); Date toDate);
} }

View File

@@ -62,11 +62,10 @@ spring.ai.vectorstore.chroma.client.key-token=BxZWXFXC4UMSxamf5xP5SioGIg3FPfP7
spring.ai.vectorstore.chroma.initialize-schema=true spring.ai.vectorstore.chroma.initialize-schema=true
spring.ai.vectorstore.chroma.collection-name=olympus spring.ai.vectorstore.chroma.collection-name=olympus
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=10MB spring.servlet.multipart.max-request-size=20MB
file.upload-dir=/mnt/hermione_storage/documents/file_input_scenarios/ file.upload-dir=/mnt/hermione_storage/documents/file_input_scenarios/
# file.upload-dir=C:\\mnt\\hermione_storage\\documents\\file_input_scenarios\\
generic-file-parser-module.url=http://generic-file-parser-module-service.olympus.svc.cluster.local:8080 generic-file-parser-module.url=http://generic-file-parser-module-service.olympus.svc.cluster.local:8080