Subversion Repositories SmartDukaan

Rev

Rev 37729 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37729 Rev 37737
Line 44... Line 44...
44
 
44
 
45
    @Autowired
45
    @Autowired
46
    LeadRepository leadRepository;
46
    LeadRepository leadRepository;
47
 
47
 
48
    @Autowired
48
    @Autowired
-
 
49
    com.spice.profitmandi.service.LmsAssignmentService lmsAssignmentService;
-
 
50
 
-
 
51
    @Autowired
49
    private com.spice.profitmandi.dao.service.lead.LeadCreationService leadCreationService;
52
    private com.spice.profitmandi.dao.service.lead.LeadCreationService leadCreationService;
50
 
53
 
51
    @Override
54
    @Override
52
    public void sentMailForTrialUser(TrialForm trialForm) throws Exception {
55
    public void sentMailForTrialUser(TrialForm trialForm) throws Exception {
53
        String body =
56
        String body =
Line 319... Line 322...
319
            lead.setStatus(LeadStatus.pending);
322
            lead.setStatus(LeadStatus.pending);
320
            lead.setColor("yellow");
323
            lead.setColor("yellow");
321
            lead.setCreatedBy("system");
324
            lead.setCreatedBy("system");
322
            lead.setCreatedTimestamp(LocalDateTime.now());
325
            lead.setCreatedTimestamp(LocalDateTime.now());
323
            lead.setUpdatedTimestamp(LocalDateTime.now());
326
            lead.setUpdatedTimestamp(LocalDateTime.now());
-
 
327
            // Trial signups are leads like any other: region from the state on the form, and the
-
 
328
            // same 5-hour first-contact commitment. Status stays pending — this method owns it.
-
 
329
            lmsAssignmentService.stamp(lead, "A");
324
            // Unattended: a trial signup has no agent to offer an override to. A collision is
330
            // Unattended: a trial signup has no agent to offer an override to. A collision is
325
            // skipped and mailed to the Call Center desk rather than creating a second live lead.
331
            // skipped and mailed to the Call Center desk rather than creating a second live lead.
326
            leadCreationService.createUnattended(lead);
332
            leadCreationService.createUnattended(lead);
-
 
333
            // Guarded, because a skipped collision leaves the lead unpersisted — stamping and
-
 
334
            // persisting it here would create the very duplicate the service declined.
-
 
335
            if (lead.getId() > 0) {
-
 
336
                lead.setLmsCode(lmsAssignmentService.generateLmsCode(lead));
-
 
337
                leadRepository.persist(lead);
-
 
338
            }
327
            LOGGER.info("Trial-to-Lead created: leadId={} for trialMobile={}", lead.getId(), trialForm.getMobile());
339
            LOGGER.info("Trial-to-Lead created: leadId={} for trialMobile={}", lead.getId(), trialForm.getMobile());
328
        } catch (Exception e) {
340
        } catch (Exception e) {
329
            LOGGER.error("Failed to create Lead from Trial for mobile=" + trialForm.getMobile(), e);
341
            LOGGER.error("Failed to create Lead from Trial for mobile=" + trialForm.getMobile(), e);
330
        }
342
        }
331
 
343