[agent-pipeline] pipe-20260328115913-ckmt round-1
This commit is contained in:
@@ -2,39 +2,46 @@ package com.erp.controller;
|
||||
|
||||
import com.erp.dto.ApiResponse;
|
||||
import com.erp.service.DeliveryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/delivery")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeliveryController {
|
||||
|
||||
private final DeliveryService deliveryService;
|
||||
@Autowired private DeliveryService deliveryService;
|
||||
|
||||
@GetMapping("/status")
|
||||
public ResponseEntity<ApiResponse<Map<String, Object>>> getDeliveryStatus(
|
||||
@RequestAttribute("companyCode") String companyCode) {
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getDeliveryStatus(companyCode)));
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("companyCode", companyCode);
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getDeliveryStatus(params)));
|
||||
}
|
||||
|
||||
@GetMapping("/delayed")
|
||||
public ResponseEntity<ApiResponse<List<Map<String, Object>>>> getDelayedDeliveries(
|
||||
@RequestAttribute("companyCode") String companyCode) {
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getDelayedDeliveries(companyCode)));
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("companyCode", companyCode);
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getDelayedDeliveries(params)));
|
||||
}
|
||||
|
||||
@GetMapping("/issues")
|
||||
public ResponseEntity<ApiResponse<List<Map<String, Object>>>> getCustomerIssues(
|
||||
@RequestAttribute("companyCode") String companyCode,
|
||||
@RequestParam(required = false) String status) {
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getCustomerIssues(companyCode, status)));
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("companyCode", companyCode);
|
||||
if (status != null) params.put("status", status);
|
||||
return ResponseEntity.ok(ApiResponse.success(deliveryService.getCustomerIssues(params)));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/status")
|
||||
@@ -42,9 +49,9 @@ public class DeliveryController {
|
||||
@RequestAttribute("companyCode") String companyCode,
|
||||
@PathVariable String id,
|
||||
@RequestBody Map<String, Object> body) {
|
||||
String status = (String) body.get("status");
|
||||
String delayReason = (String) body.get("delayReason");
|
||||
deliveryService.updateDeliveryStatus(companyCode, id, status, delayReason);
|
||||
body.put("companyCode", companyCode);
|
||||
body.put("id", id);
|
||||
deliveryService.updateDeliveryStatus(body);
|
||||
return ResponseEntity.ok(ApiResponse.success(null));
|
||||
}
|
||||
|
||||
@@ -53,8 +60,9 @@ public class DeliveryController {
|
||||
@RequestAttribute("companyCode") String companyCode,
|
||||
@PathVariable String id,
|
||||
@RequestBody Map<String, Object> body) {
|
||||
String status = (String) body.get("status");
|
||||
deliveryService.updateIssueStatus(companyCode, id, status);
|
||||
body.put("companyCode", companyCode);
|
||||
body.put("id", id);
|
||||
deliveryService.updateIssueStatus(body);
|
||||
return ResponseEntity.ok(ApiResponse.success(null));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user