| Line 920... |
Line 920... |
| 920 |
|
920 |
|
| 921 |
Lead lead = leadRepository.selectById(createLeadActivityRequest.getId());
|
921 |
Lead lead = leadRepository.selectById(createLeadActivityRequest.getId());
|
| 922 |
AuthUser leadAuthUser = authRepository.selectById(lead.getAuthId());
|
922 |
AuthUser leadAuthUser = authRepository.selectById(lead.getAuthId());
|
| 923 |
LeadDetail leadDetail = leadDetailRepository.selectByLeadId(createLeadActivityRequest.getId());
|
923 |
LeadDetail leadDetail = leadDetailRepository.selectByLeadId(createLeadActivityRequest.getId());
|
| 924 |
|
924 |
|
| - |
|
925 |
// Geo gate: required for follow-up / finalized (anything that schedules
|
| 925 |
// Unconditional gate: a lead can only be edited once its live geo-location
|
926 |
// a visit or beat slot). For notInterested (close-out) no geo / no beat
|
| 926 |
// is APPROVED. UI also pre-checks; this is the server-side safety net.
|
927 |
// is needed — only the activity (status + reason + remark) is saved.
|
| - |
|
928 |
if (createLeadActivityRequest.getStatus() != LeadStatus.notInterested) {
|
| 927 |
LeadLiveLocation approvedGeo = leadLiveLocationRepository.selectApprovedByLeadId(createLeadActivityRequest.getId());
|
929 |
LeadLiveLocation approvedGeo = leadLiveLocationRepository.selectApprovedByLeadId(createLeadActivityRequest.getId());
|
| 928 |
if (approvedGeo == null) {
|
930 |
if (approvedGeo == null) {
|
| 929 |
throw new ProfitMandiBusinessException("Lead", "", "Live geo-location for this lead has not been approved yet. Please approve the geo-location before editing.");
|
931 |
throw new ProfitMandiBusinessException("Lead", "", "Live geo-location for this lead has not been approved yet. Please approve the geo-location before editing.");
|
| - |
|
932 |
}
|
| 930 |
}
|
933 |
}
|
| 931 |
|
934 |
|
| 932 |
if (leadDetail == null && !createLeadActivityRequest.getStatus().equals(LeadStatus.notInterested) && leadAuthUser.isActive()) {
|
935 |
if (leadDetail == null && !createLeadActivityRequest.getStatus().equals(LeadStatus.notInterested) && leadAuthUser.isActive()) {
|
| 933 |
|
936 |
|
| 934 |
throw new ProfitMandiBusinessException("LeadDetail", "", "Please fill lead detail");
|
937 |
throw new ProfitMandiBusinessException("LeadDetail", "", "Please fill lead detail");
|