| Line 560... |
Line 560... |
| 560 |
msg.append(" for ").append(au.getFirstName()).append(" ").append(au.getLastName());
|
560 |
msg.append(" for ").append(au.getFirstName()).append(" ").append(au.getLastName());
|
| 561 |
result.put("message", msg.toString());
|
561 |
result.put("message", msg.toString());
|
| 562 |
return responseSender.ok(result);
|
562 |
return responseSender.ok(result);
|
| 563 |
}
|
563 |
}
|
| 564 |
|
564 |
|
| - |
|
565 |
// Close a MANUAL agenda instance. AUTO instances are refused inside
|
| - |
|
566 |
// AgendaInstanceService.closeManual — they close only when their metric
|
| - |
|
567 |
// normalizes (nightly cron).
|
| - |
|
568 |
@PostMapping(value = "/beatPlan/agenda/close")
|
| - |
|
569 |
public ResponseEntity<?> closeAgenda(
|
| - |
|
570 |
HttpServletRequest request,
|
| - |
|
571 |
@org.springframework.web.bind.annotation.RequestBody Map<String, Object> body) throws Exception {
|
| - |
|
572 |
Integer instanceId = body.get("instanceId") != null ? ((Number) body.get("instanceId")).intValue() : null;
|
| - |
|
573 |
String remark = body.get("remark") != null ? String.valueOf(body.get("remark")).trim() : null;
|
| - |
|
574 |
if (instanceId == null) return responseSender.badRequest("instanceId is required");
|
| - |
|
575 |
|
| - |
|
576 |
AuthUser operator = currentUser(request);
|
| - |
|
577 |
if (operator == null) return responseSender.badRequest("Not logged in");
|
| - |
|
578 |
|
| - |
|
579 |
AgendaInstance instance = agendaInstanceRepository.selectById(instanceId);
|
| - |
|
580 |
if (instance == null) return responseSender.badRequest("Agenda instance not found");
|
| - |
|
581 |
try {
|
| - |
|
582 |
agendaInstanceService.closeManual(instance, operator.getId(), remark);
|
| - |
|
583 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
584 |
return responseSender.badRequest(e.getMessage());
|
| - |
|
585 |
}
|
| - |
|
586 |
Map<String, Object> result = new HashMap<>();
|
| - |
|
587 |
result.put("status", true);
|
| - |
|
588 |
result.put("instanceId", instanceId);
|
| - |
|
589 |
return responseSender.ok(result);
|
| - |
|
590 |
}
|
| - |
|
591 |
|
| 565 |
// ====================== DEFERRED PARTNERS ======================
|
592 |
// ====================== DEFERRED PARTNERS ======================
|
| 566 |
// Heads review partners that weren't visited on their planned day and act on
|
593 |
// Heads review partners that weren't visited on their planned day and act on
|
| 567 |
// them. The deferral lifecycle lives in user.beat_deferred_visit (separate
|
594 |
// them. The deferral lifecycle lives in user.beat_deferred_visit (separate
|
| 568 |
// from the raw location_tracking event log). Detection = explicit
|
595 |
// from the raw location_tracking event log). Detection = explicit
|
| 569 |
// (mark_type='DEFERRED') + derived (planned beat_route minus completed visits).
|
596 |
// (mark_type='DEFERRED') + derived (planned beat_route minus completed visits).
|