Files
votianng/backend/src/main/java/de/stadtbote/votian/CrmController.java
T
Sven 781a2b82dc Erweitere VoTiAn NG um Fachfunktionen und verbessere die Listenoberfläche
Ergänze Auftragsbearbeitung, Disposition, Stammdaten, Kunden- und
Transporteurportale, Lagerverwaltung, Abrechnung, Exporte und Statistik.
Füge Kontoeinstellungen, Mitteilungen, Automatikdienste und Betriebsstatus
sowie die zugehörigen Tests und PHP-Abgleichsdokumentation hinzu.

Vergrößere die persönlichen Auftragslisten auf einheitliche Höhen und
richte Statusanzeigen sowie die Ranking-Vorschau-Steuerelemente bündig aus.

Validierung: 44 Frontendtests und Produktionsbuild erfolgreich.
Backend funktional unverändert gegenüber dem vollständigen Lauf mit 1.624
erfolgreichen und drei übersprungenen Tests. Layout im Browser und lokale
Bereitstellung geprüft.
2026-10-20 11:19:43 +02:00

27 lines
2.7 KiB
Java

package de.stadtbote.votian;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import static de.stadtbote.votian.ApiController.user;
@RestController
@RequestMapping("/api/crm")
class CrmController {
private final ContactService contacts;private final SalesAnalytics sales;
CrmController(ContactService contacts,SalesAnalytics sales){this.contacts=contacts;this.sales=sales;}
@GetMapping("/options") Map<String,Object> options(Authentication a){return sales.options(user(a));}
@GetMapping("/contacts/schema") Map<String,Object> schema(Authentication a,@RequestParam long headquarters){return contacts.schema(user(a),headquarters);}
@GetMapping("/contacts/draft") Map<String,Object> draft(Authentication a,@RequestParam long headquarters,@RequestParam(required=false) Long customerId){return contacts.draft(user(a),headquarters,customerId);}
@PostMapping("/contacts/query") List<Map<String,Object>> contacts(Authentication a,@RequestBody ContactService.Query q){return contacts.list(user(a),q);}
@GetMapping("/contacts/{id}") Map<String,Object> contact(Authentication a,@PathVariable long id,@RequestParam long headquarters){return contacts.get(user(a),headquarters,id);}
@GetMapping("/contacts/{id}/history") List<Map<String,Object>> history(Authentication a,@PathVariable long id,@RequestParam long headquarters){return contacts.history(user(a),headquarters,id);}
@PostMapping("/contacts") Map<String,Object> create(Authentication a,@RequestBody ContactService.Save s){return contacts.save(user(a),null,s);}
@PutMapping("/contacts/{id}") Map<String,Object> save(Authentication a,@PathVariable long id,@RequestBody ContactService.Save s){return contacts.save(user(a),id,s);}
record Delete(long headquarters,String revision){}
@DeleteMapping("/contacts/{id}") @ResponseStatus(org.springframework.http.HttpStatus.NO_CONTENT) void remove(Authentication a,@PathVariable long id,@RequestBody Delete s){contacts.remove(user(a),s.headquarters(),id,s.revision());}
@PostMapping("/switches") Map<String,Object> switches(Authentication a,@RequestBody SalesAnalytics.Query q){return sales.switches(user(a),q);}
record Motivation(String month,List<Long> headquarters){}
@PostMapping("/motivation") Map<String,Object> motivation(Authentication a,@RequestBody Motivation q){return sales.motivation(user(a),q.month(),q.headquarters());}
@PostMapping("/targets/query") List<Map<String,Object>> targets(Authentication a,@RequestBody SalesAnalytics.TargetAccess s){return sales.targets(user(a),s);}
@PostMapping("/targets") Map<String,Object> target(Authentication a,@RequestBody SalesAnalytics.Target s){return sales.target(user(a),s);}
}