Update Spring servlet max-size and fix dashboard bug

This commit is contained in:
2025-07-02 16:47:05 +02:00
parent 5ff76a0957
commit 143fb9569a
3 changed files with 41 additions and 28 deletions

View File

@@ -146,22 +146,33 @@ public class DashboardExecutionController {
List<User> users = dashboardUserRepository.findUsersByLstProjectsIn(objectIds);
return ResponseEntity.ok(users);
} catch (Exception e) {
// Log dell'errore
logger.error("Error fetching users by projects: ", e);
return ResponseEntity.internalServerError().body(null);
}
}
@GetMapping("/scenarios-filter")
public ResponseEntity<List<Scenario>> getScenarios(@RequestParam String selectedAccount) {
public ResponseEntity<List<Scenario>> getScenarios(@RequestParam String selectedAccount,
@RequestParam String dateFrom,
@RequestParam String dateTo) {
try {
List<Scenario> scenarios = dashboardScenariosRepository.findAllForAccount(selectedAccount);
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")
public ResponseEntity<List<DashboardResponse>> getChatStats (@RequestBody DashboardChatInput filters) {
try {

View File

@@ -1,11 +1,8 @@
package com.olympus.hermione.repository.dashboard;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.bson.types.ObjectId;
import org.bson.Document;
import org.springframework.data.mongodb.repository.Aggregation;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
@@ -38,6 +35,14 @@ public interface DashboardScenarioExecutionRepository extends MongoRepository<Sc
@Query("{ 'lstProjects': { $in: ?0 }}")
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 = {
"{ '$match': { " +
@@ -97,5 +102,3 @@ List<DashboardResponse> execStatsByFilters(
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.collection-name=olympus
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=20MB
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