Subversion Repositories SmartDukaan

Rev

Rev 35075 | Rev 35288 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35075 Rev 35079
Line 6... Line 6...
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
7
import com.spice.profitmandi.common.model.CustomRetailer;
7
import com.spice.profitmandi.common.model.CustomRetailer;
8
import com.spice.profitmandi.common.model.ProfitMandiConstants;
8
import com.spice.profitmandi.common.model.ProfitMandiConstants;
9
import com.spice.profitmandi.common.model.SendNotificationModel;
9
import com.spice.profitmandi.common.model.SendNotificationModel;
10
import com.spice.profitmandi.common.util.FileUtil;
10
import com.spice.profitmandi.common.util.FileUtil;
11
import com.spice.profitmandi.common.util.FormattingUtils;
-
 
12
import com.spice.profitmandi.common.web.util.ResponseSender;
11
import com.spice.profitmandi.common.web.util.ResponseSender;
13
import com.spice.profitmandi.dao.entity.auth.AuthUser;
12
import com.spice.profitmandi.dao.entity.auth.AuthUser;
14
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionPlan;
13
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionPlan;
15
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionRemark;
14
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionRemark;
16
import com.spice.profitmandi.dao.entity.auth.PartnerSecondaryPlan;
15
import com.spice.profitmandi.dao.entity.auth.PartnerSecondaryPlan;
Line 33... Line 32...
33
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
32
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
34
import com.spice.profitmandi.dao.repository.user.AddressRepository;
33
import com.spice.profitmandi.dao.repository.user.AddressRepository;
35
import com.spice.profitmandi.service.AuthService;
34
import com.spice.profitmandi.service.AuthService;
36
import com.spice.profitmandi.service.NotificationService;
35
import com.spice.profitmandi.service.NotificationService;
37
import com.spice.profitmandi.service.PartnerCollectionService;
36
import com.spice.profitmandi.service.PartnerCollectionService;
38
import com.spice.profitmandi.service.inventory.InventoryService;
-
 
39
import com.spice.profitmandi.service.user.RetailerService;
37
import com.spice.profitmandi.service.user.RetailerService;
40
import com.spice.profitmandi.service.user.StoreTimelineTatService;
38
import com.spice.profitmandi.service.user.StoreTimelineTatService;
41
import com.spice.profitmandi.web.req.CreateFranchiseeRequest;
39
import com.spice.profitmandi.web.req.CreateFranchiseeRequest;
42
import com.spice.profitmandi.web.req.RbmSalesRatingRequest;
40
import com.spice.profitmandi.web.req.RbmSalesRatingRequest;
43
import com.spice.profitmandi.web.res.Partner;
41
import com.spice.profitmandi.web.res.Partner;
Line 189... Line 187...
189
    @RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
187
    @RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
190
    @ApiImplicitParams({
188
    @ApiImplicitParams({
191
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
189
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
192
 
190
 
193
    public ResponseEntity<?> LeadUser(@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
191
    public ResponseEntity<?> LeadUser(@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
194
        LOGGER.info("CreateRefferalRequest - " + createRefferalRequest);
192
        LOGGER.info("CreateReferralRequest - " + createRefferalRequest);
195
        if (createRefferalRequest.getOutletName() == null || createRefferalRequest.getPotential() == 0) {
193
        if (createRefferalRequest.getOutletName() == null || createRefferalRequest.getPotential() == 0) {
196
            throw new Exception("Outlet should not be empty and potential shoul be greator > 0");
194
            throw new Exception("Outlet should not be empty and potential should be greater > 0");
197
        }
195
        }
198
        List<Lead> leadDetail = leadRepository.selectByMobileNumber(createRefferalRequest.getMobile());
196
        /*Lead leadDetail = leadRepository.selectByMobileNumber(createRefferalRequest.getMobile());
199
        LOGGER.info("Lead Details {}", leadDetail);
197
        LOGGER.info("Lead Details {}", leadDetail);
200
        if (!leadDetail.isEmpty() && leadDetail.get(0).getStatus() != LeadStatus.notInterested) {
198
        if (leadDetail != null && leadDetail.getStatus() != LeadStatus.notInterested) {
201
            AuthUser authUser1 = authRepository.selectById(leadDetail.get(0).getAssignTo());
199
            AuthUser authUser1 = authRepository.selectById(leadDetail.getAssignTo());
202
            return responseSender.ok(" Duplicate Entry: Lead already exists, created by " + leadDetail.get(0).getCreatedBy() + " on " + FormattingUtils.format(leadDetail.get(0).getCreatedTimestamp()) + "assigned to " + authUser1.getFullName());
200
            return responseSender.ok("Duplicate Entry: Lead already exists, created by " + leadDetail.getCreatedBy() + " on " + FormattingUtils.format(leadDetail.getCreatedTimestamp()) + " assigned to " + authUser1.getFullName());
-
 
201
        }*/
203
 
202
 
204
        }
-
 
205
 
-
 
206
        Lead lead = new Lead();
203
        Lead lead = (createRefferalRequest.getId() > 0) ? leadRepository.selectById(createRefferalRequest.getId()) : new Lead();
207
        lead.setFirstName(createRefferalRequest.getFirstName());
204
        lead.setFirstName(createRefferalRequest.getFirstName());
208
        lead.setLastName(createRefferalRequest.getLastName());
205
        lead.setLastName(createRefferalRequest.getLastName());
209
        lead.setLeadMobile(createRefferalRequest.getMobile());
206
        lead.setLeadMobile(createRefferalRequest.getMobile());
210
        lead.setState(createRefferalRequest.getState());
207
        lead.setState(createRefferalRequest.getState());
211
        lead.setCity(createRefferalRequest.getCity());
208
        lead.setCity(createRefferalRequest.getCity());
Line 222... Line 219...
222
        } else {
219
        } else {
223
            lead.setColor("Yellow");
220
            lead.setColor("Yellow");
224
        }
221
        }
225
        AuthUser authUser = authRepository.selectByGmailId(createRefferalRequest.getReffereeEmail());
222
        AuthUser authUser = authRepository.selectByGmailId(createRefferalRequest.getReffereeEmail());
226
        String authUserName = authUser.getFullName();
223
        String authUserName = authUser.getFullName();
227
        lead.setCreatedBy(authUserName);
-
 
228
        lead.setAuthId(authUser.getId());
224
        lead.setAuthId(authUser.getId());
229
        lead.setAssignTo(authUser.getId());
225
        lead.setAssignTo(authUser.getId());
230
 
226
 
-
 
227
        if(createRefferalRequest.getId() == 0) {
-
 
228
            lead.setCreatedBy(authUserName);
231
        leadRepository.persist(lead);
229
            leadRepository.persist(lead);
-
 
230
        }
232
 
231
 
233
 
232
 
234
//        int counter = 0;
233
//        int counter = 0;
235
//
234
//
236
//        List<Integer> photos = Arrays.asList(
235
//        List<Integer> photos = Arrays.asList(
Line 335... Line 334...
335
 
334
 
336
                }
335
                }
337
            }
336
            }
338
 
337
 
339
            leads = leads.stream()
338
            leads = leads.stream()
340
                    .sorted(Comparator.comparing(Lead::getScheduledTimestamp,
339
                    .sorted(Comparator.comparing(Lead::getScheduledTimestamp, Comparator.nullsFirst(Comparator.reverseOrder())))
341
                            Comparator.nullsFirst(Comparator.reverseOrder())))
-
 
342
                    .collect(Collectors
340
                    .collect(Collectors.toList());
343
                            .toList());/*
341
            /*
344
             * Collections.sort(leads, (o1, o2) -> { if (o1.getScheduledTimestamp() != null
342
             * Collections.sort(leads, (o1, o2) -> { if (o1.getScheduledTimestamp() != null
345
             * && o2.getScheduledTimestamp() != null) { return
343
             * && o2.getScheduledTimestamp() != null) { return
346
             * o1.getScheduledTimestamp().isBefore(o2.getScheduledTimestamp()) ? -1 : 1; }
344
             * o1.getScheduledTimestamp().isBefore(o2.getScheduledTimestamp()) ? -1 : 1; }
347
             * else if (o1.getScheduledTimestamp() != null) { return 1; } else { return -1;
345
             * else if (o1.getScheduledTimestamp() != null) { return 1; } else { return -1;
348
             * } });
346
             * } });
Line 356... Line 354...
356
        return responseSender.ok(leads);
354
        return responseSender.ok(leads);
357
 
355
 
358
    }
356
    }
359
 
357
 
360
    @RequestMapping(value = "/getlead", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
358
    @RequestMapping(value = "/getlead", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
361
    @ApiImplicitParams({
-
 
362
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
359
    @ApiImplicitParams({ @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
363
    public ResponseEntity<?> getLead(HttpServletRequest request, @RequestParam(name = "id") int id)
360
    public ResponseEntity<?> getLead(HttpServletRequest request, @RequestParam(name = "id") int id) throws ProfitMandiBusinessException {
364
            throws ProfitMandiBusinessException {
-
 
365
 
361
 
366
        List<LeadActivity> leadActivities = leadActivityRepository.selectBYLeadId(id);
362
        List<LeadActivity> leadActivities = leadActivityRepository.selectBYLeadId(id);
367
        Lead lead = leadRepository.selectById(id);
363
        Lead lead = leadRepository.selectById(id);
368
        lead.setLeadActivities(leadActivities);
364
        lead.setLeadActivities(leadActivities);
369
        return responseSender.ok(lead);
365
        return responseSender.ok(lead);
370
 
366
 
371
    }
367
    }
372
 
368
 
-
 
369
    @RequestMapping(value = "/check-existing-lead", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
370
    @ApiImplicitParams({ @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
-
 
371
    public ResponseEntity<?> getLeadByMobile(HttpServletRequest request, @RequestParam(name = "mobile") String mobile) throws ProfitMandiBusinessException {
-
 
372
        int userId = (int) request.getAttribute("userId");
-
 
373
        LOGGER.info("userId: " + userId);
-
 
374
        Lead lead = leadRepository.selectByMobileNumber(mobile);
-
 
375
        return responseSender.ok(lead);
-
 
376
 
-
 
377
    }
-
 
378
 
373
    @RequestMapping(value = "/leadUpdate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
379
    @RequestMapping(value = "/leadUpdate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
374
    @ApiImplicitParams({
-
 
375
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
380
    @ApiImplicitParams({ @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
376
    public ResponseEntity<?> leadUpdate(HttpServletRequest request, @RequestParam(name = "id") int id,
381
    public ResponseEntity<?> leadUpdate(HttpServletRequest request, @RequestParam(name = "id") int id,
377
                                        @RequestParam(name = "status") LeadStatus status, @RequestParam(name = "colorCheck") Boolean colorCheck,
382
            @RequestParam(name = "status") LeadStatus status, @RequestParam(name = "colorCheck") Boolean colorCheck,
378
                                        @RequestParam(name = "remark") String remark, @RequestParam(name = "reason") String reason,
383
            @RequestParam(name = "remark") String remark, @RequestParam(name = "reason") String reason,
379
                                        @RequestParam(name = "schelduleTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime schelduleTimestamp,
384
            @RequestParam(name = "schelduleTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime schelduleTimestamp,
380
                                        @RequestParam(name = "closureTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime closureTimestamp,
385
            @RequestParam(name = "closureTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime closureTimestamp,
381
                                        @RequestParam(name = "communicationType") CommunicationType communicationType)
386
            @RequestParam(name = "communicationType") CommunicationType communicationType) throws ProfitMandiBusinessException {
382
            throws ProfitMandiBusinessException {
-
 
383
 
387
 
384
        Lead lead = leadRepository.selectById(id);
388
        Lead lead = leadRepository.selectById(id);
385
 
389
 
386
 
-
 
387
        LeadActivity leadActivity = new LeadActivity();
390
        LeadActivity leadActivity = new LeadActivity();
388
        lead.setStatus(status);
391
        lead.setStatus(status);
389
        lead.setNotinterestedReason(reason);
392
        lead.setNotinterestedReason(reason);
390
        leadActivity.setRemark(remark);
393
        leadActivity.setRemark(remark);
391
        leadActivity.setLeadId(id);
394
        leadActivity.setLeadId(id);
Line 407... Line 410...
407
 
410
 
408
                leadActivity.setCommunicationType(communicationType);
411
                leadActivity.setCommunicationType(communicationType);
409
 
412
 
410
                if (leadActivity.getCommunicationType().equals(CommunicationType.VISIT)) {
413
                if (leadActivity.getCommunicationType().equals(CommunicationType.VISIT)) {
411
 
414
 
412
                    visitRequestRepository.createVisitRequest(lead.getId(), "lead", lead.getAssignTo(),
415
                    visitRequestRepository.createVisitRequest(lead.getId(), "lead", lead.getAssignTo(), schelduleTimestamp);
413
                            schelduleTimestamp);
-
 
414
                }
416
                }
415
 
417
 
416
            }
418
            }
417
            leadActivity.setSchelduleTimestamp(schelduleTimestamp);
419
            leadActivity.setSchelduleTimestamp(schelduleTimestamp);
418
            leadActivity.setClosureTimestamp(closureTimestamp);
420
            leadActivity.setClosureTimestamp(closureTimestamp);
Line 429... Line 431...
429
        return responseSender.ok(true);
431
        return responseSender.ok(true);
430
 
432
 
431
    }
433
    }
432
 
434
 
433
    @RequestMapping(value = ProfitMandiConstants.URL_NEW_LEAD, method = RequestMethod.POST)
435
    @RequestMapping(value = ProfitMandiConstants.URL_NEW_LEAD, method = RequestMethod.POST)
434
    public ResponseEntity<?> newLead(HttpServletRequest request,
-
 
435
                                     @RequestBody CreateRefferalRequest createRefferalRequest) throws ProfitMandiBusinessException {
436
    public ResponseEntity<?> newLead(HttpServletRequest request, @RequestBody CreateRefferalRequest createRefferalRequest) throws ProfitMandiBusinessException {
436
        LOGGER.info("requested url : " + request.getRequestURL().toString());
437
        LOGGER.info("requested url : " + request.getRequestURL().toString());
437
        Lead lead = new Lead();
438
        Lead lead = new Lead();
438
        lead.setAddress(createRefferalRequest.getCity());
439
        lead.setAddress(createRefferalRequest.getCity());
439
        Long.parseLong(createRefferalRequest.getMobile());
440
        Long.parseLong(createRefferalRequest.getMobile());
440
        if (createRefferalRequest.getMobile().length() != 10) {
441
        if (createRefferalRequest.getMobile().length() != 10) {
441
            throw new ProfitMandiBusinessException("Mobile Number", createRefferalRequest.getMobile(),
442
            throw new ProfitMandiBusinessException("Mobile Number", createRefferalRequest.getMobile(), "Number should be of 10 digits");
442
                    "Number should be of 10 digits");
-
 
443
        }
443
        }
444
        lead.setLeadMobile(createRefferalRequest.getMobile());
444
        lead.setLeadMobile(createRefferalRequest.getMobile());
445
        lead.setCity(createRefferalRequest.getCity());
445
        lead.setCity(createRefferalRequest.getCity());
446
        lead.setState(createRefferalRequest.getState());
446
        lead.setState(createRefferalRequest.getState());
447
        lead.setLastName(createRefferalRequest.getLastName());
447
        lead.setLastName(createRefferalRequest.getLastName());
Line 470... Line 470...
470
        return responseSender.ok(true);
470
        return responseSender.ok(true);
471
 
471
 
472
    }
472
    }
473
 
473
 
474
    @RequestMapping(value = "/getPartnersList", method = RequestMethod.GET)
474
    @RequestMapping(value = "/getPartnersList", method = RequestMethod.GET)
475
    @ApiImplicitParams({
-
 
476
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
475
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
477
    public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId)
476
    public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId)
478
            throws ProfitMandiBusinessException {
477
            throws ProfitMandiBusinessException {
479
 
478
 
480
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
479
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
481
 
480
 
Line 505... Line 504...
505
        LOGGER.info("partners" + partners);
504
        LOGGER.info("partners" + partners);
506
        return responseSender.ok(partners);
505
        return responseSender.ok(partners);
507
    }
506
    }
508
 
507
 
509
    @RequestMapping(value = "/franchise-first-visit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
508
    @RequestMapping(value = "/franchise-first-visit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
510
    @ApiImplicitParams({
-
 
511
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
509
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
512
    public ResponseEntity<?> FranchiseFirstVisit(HttpServletRequest request,
-
 
513
                                                 @RequestBody CreateFranchiseeRequest createFranchiseeRequest) throws Exception {
510
    public ResponseEntity<?> FranchiseFirstVisit(HttpServletRequest request, @RequestBody CreateFranchiseeRequest createFranchiseeRequest) throws Exception {
514
 
511
 
515
        FranchiseeVisit franchiseeVisit = new FranchiseeVisit();
512
        FranchiseeVisit franchiseeVisit = new FranchiseeVisit();
516
        franchiseeVisit.setFofoId(createFranchiseeRequest.getFofoId());
513
        franchiseeVisit.setFofoId(createFranchiseeRequest.getFofoId());
517
        CustomRetailer customRetailer = retailerService.getFofoRetailer(createFranchiseeRequest.getFofoId());
514
        CustomRetailer customRetailer = retailerService.getFofoRetailer(createFranchiseeRequest.getFofoId());
518
 
515
 
Line 540... Line 537...
540
        franchiseeActivity.setCreatedTimestamp(LocalDateTime.now());
537
        franchiseeActivity.setCreatedTimestamp(LocalDateTime.now());
541
        franchiseeActivityRepository.persist(franchiseeActivity);
538
        franchiseeActivityRepository.persist(franchiseeActivity);
542
 
539
 
543
        franchiseeVisit.setFranchiseActivityId(franchiseeActivity.getId());
540
        franchiseeVisit.setFranchiseActivityId(franchiseeActivity.getId());
544
 
541
 
545
        visitRequestRepository.createVisitRequest(franchiseeVisit.getId(), "franchiseeVisit", authUser.getId(),
542
        visitRequestRepository.createVisitRequest(franchiseeVisit.getId(), "franchiseeVisit", authUser.getId(), createFranchiseeRequest.getFirstSchelduleTimestamp());
546
                createFranchiseeRequest.getFirstSchelduleTimestamp());
-
 
547
 
543
 
548
        return responseSender.ok(true);
544
        return responseSender.ok(true);
549
    }
545
    }
550
 
546
 
551
    @RequestMapping(value = "/franchise-visit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
547
    @RequestMapping(value = "/franchise-visit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
552
    @ApiImplicitParams({
-
 
553
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
548
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
554
    public ResponseEntity<?> FranchiseVisit(HttpServletRequest request,
549
    public ResponseEntity<?> FranchiseVisit(HttpServletRequest request,
555
                                            @RequestBody CreateFranchiseeRequest createFranchiseeRequest) throws Exception {
550
                                            @RequestBody CreateFranchiseeRequest createFranchiseeRequest) throws Exception {
556
 
551
 
557
        int rbmL1 = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, createFranchiseeRequest.getFofoId());
552
        int rbmL1 = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, createFranchiseeRequest.getFofoId());
558
 
553
 
Line 641... Line 636...
641
 
636
 
642
        if (!createFranchiseeRequest.getHygieneReason().isEmpty()) {
637
        if (!createFranchiseeRequest.getHygieneReason().isEmpty()) {
643
            csService.createTicket(createFranchiseeRequest.getFofoId(), ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_SALES_LOW_DATA_ACCURACY, createFranchiseeRequest.getHygieneReason(), authUser.getId());
638
            csService.createTicket(createFranchiseeRequest.getFofoId(), ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_SALES_LOW_DATA_ACCURACY, createFranchiseeRequest.getHygieneReason(), authUser.getId());
644
        }
639
        }
645
 
640
 
646
 
-
 
647
        return responseSender.ok(true);
641
        return responseSender.ok(true);
648
 
642
 
649
    }
643
    }
650
 
644
 
651
    @RequestMapping(value = "/getFranchiseVisit", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
645
    @RequestMapping(value = "/getFranchiseVisit", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
652
    @ApiImplicitParams({
-
 
653
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
646
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
654
    public ResponseEntity<?> getFranchiseVisit(HttpServletRequest request,
647
    public ResponseEntity<?> getFranchiseVisit(HttpServletRequest request,
655
                                               @RequestParam(name = "gmailId") String gmailId, @RequestParam(name = "status") FranchiseeVisitStatus status,
648
                                               @RequestParam(name = "gmailId") String gmailId, @RequestParam(name = "status") FranchiseeVisitStatus status,
656
                                               @RequestParam(name = "offset", defaultValue = "0") int offset,
649
                                               @RequestParam(name = "offset", defaultValue = "0") int offset,
657
                                               @RequestParam(name = "limit", defaultValue = "10") int limit) throws ProfitMandiBusinessException {
650
                                               @RequestParam(name = "limit", defaultValue = "10") int limit) throws ProfitMandiBusinessException {
658
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
651
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
659
        List<VisitRequest> visitRequests = visitRequestRepository.selectByAuthIdAndDate(authUser.getId(),
652
        List<VisitRequest> visitRequests = visitRequestRepository.selectByAuthIdAndDate(authUser.getId(), LocalDate.now());
660
                LocalDate.now());
-
 
661
        Map<Integer, List<VisitRequest>> visitRequestMap = null;
653
        Map<Integer, List<VisitRequest>> visitRequestMap = null;
662
        if (!visitRequests.isEmpty()) {
654
        if (!visitRequests.isEmpty()) {
663
            visitRequestMap = visitRequests.stream().collect(Collectors.groupingBy(x -> x.getVisitId()));
655
            visitRequestMap = visitRequests.stream().collect(Collectors.groupingBy(x -> x.getVisitId()));
664
        }
656
        }
665
        List<FranchiseeVisit> franchiseeVisits = franchiseeVisitRepository.selectByAuthIdAndStatus(authUser.getId(),
657
        List<FranchiseeVisit> franchiseeVisits = franchiseeVisitRepository.selectByAuthIdAndStatus(authUser.getId(), status, offset, limit);
666
                status, offset, limit);
-
 
667
 
658
 
668
        for (FranchiseeVisit fv : franchiseeVisits) {
659
        for (FranchiseeVisit fv : franchiseeVisits) {
669
            if (visitRequestMap != null) {
660
            if (visitRequestMap != null) {
670
 
661
 
671
                List<VisitRequest> visitRequest = visitRequestMap.get(fv.getId());
662
                List<VisitRequest> visitRequest = visitRequestMap.get(fv.getId());
672
                if (visitRequest != null) {
663
                if (visitRequest != null) {
673
                    if (visitRequest.size() > 1) {
664
                    if (visitRequest.size() > 1) {
674
 
665
 
675
                        Comparator<VisitRequest> visitComparato = Comparator
666
                        Comparator<VisitRequest> visitComparato = Comparator.comparing(VisitRequest::getCreatedTimestamp);
676
                                .comparing(VisitRequest::getCreatedTimestamp);
-
 
677
 
667
 
678
                        VisitRequest youngestVisit = visitRequest.stream().max(visitComparato).get();
668
                        VisitRequest youngestVisit = visitRequest.stream().max(visitComparato).get();
679
                        fv.setVisitStatus(youngestVisit.getStatus());
669
                        fv.setVisitStatus(youngestVisit.getStatus());
680
 
670
 
681
                    } else {
671
                    } else {
Line 694... Line 684...
694
        return responseSender.ok(franchiseeVisits);
684
        return responseSender.ok(franchiseeVisits);
695
 
685
 
696
    }
686
    }
697
 
687
 
698
    @RequestMapping(value = "/getFranchiseActivity", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
688
    @RequestMapping(value = "/getFranchiseActivity", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
699
    @ApiImplicitParams({
-
 
700
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
689
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
701
    public ResponseEntity<?> getFranchiseActivity(HttpServletRequest request, @RequestParam(name = "id") int id)
690
    public ResponseEntity<?> getFranchiseActivity(HttpServletRequest request, @RequestParam(name = "id") int id) throws ProfitMandiBusinessException {
702
            throws ProfitMandiBusinessException {
-
 
703
 
691
 
704
        List<FranchiseeActivity> franchiseeActivities = franchiseeActivityRepository.selectByFranchiseeVisitId(id);
692
        List<FranchiseeActivity> franchiseeActivities = franchiseeActivityRepository.selectByFranchiseeVisitId(id);
705
        return responseSender.ok(franchiseeActivities);
693
        return responseSender.ok(franchiseeActivities);
706
 
694
 
707
    }
695
    }
708
 
696
 
709
    @RequestMapping(value = "/getFranchiseeInfo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
697
    @RequestMapping(value = "/getFranchiseeInfo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
710
    @ApiImplicitParams({
-
 
711
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
698
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
712
    public ResponseEntity<?> getFranchiseeInfo(HttpServletRequest request, @RequestParam(name = "id") int id)
699
    public ResponseEntity<?> getFranchiseeInfo(HttpServletRequest request, @RequestParam(name = "id") int id) throws ProfitMandiBusinessException {
713
            throws ProfitMandiBusinessException {
-
 
714
        FranchiseeVisit franchiseeVisit = franchiseeVisitRepository.selectById(id);
700
        FranchiseeVisit franchiseeVisit = franchiseeVisitRepository.selectById(id);
715
 
701
 
716
        List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
702
        List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
717
 
703
 
718
        List<String> brands = mobileBrands.stream().filter(x -> (boolean) x.get("active"))
704
        List<String> brands = mobileBrands.stream().filter(x -> (boolean) x.get("active"))
Line 723... Line 709...
723
        return responseSender.ok(franchiseeVisit);
709
        return responseSender.ok(franchiseeVisit);
724
 
710
 
725
    }
711
    }
726
 
712
 
727
    @RequestMapping(value = "/franchise-visit-update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
713
    @RequestMapping(value = "/franchise-visit-update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
728
    @ApiImplicitParams({
-
 
729
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
714
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
730
    public ResponseEntity<?> franchiseVisitUpdate(HttpServletRequest request, @RequestParam(name = "id") int id,
715
    public ResponseEntity<?> franchiseVisitUpdate(HttpServletRequest request, @RequestParam(name = "id") int id, @RequestParam(name = "action") FranchiseeActivityStatus action, @RequestParam(name = "resolution") String resolution, @RequestParam(name = "schelduleTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime schelduleTimestamp)
731
                                                  @RequestParam(name = "action") FranchiseeActivityStatus action,
-
 
732
                                                  @RequestParam(name = "resolution") String resolution,
-
 
733
                                                  @RequestParam(name = "schelduleTimestamp") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime schelduleTimestamp)
-
 
734
            throws ProfitMandiBusinessException {
716
            throws ProfitMandiBusinessException {
735
        FranchiseeVisit franchiseeVisit = franchiseeVisitRepository.selectById(id);
717
        FranchiseeVisit franchiseeVisit = franchiseeVisitRepository.selectById(id);
736
 
718
 
737
        FranchiseeActivity franchiseeActivity = new FranchiseeActivity();
719
        FranchiseeActivity franchiseeActivity = new FranchiseeActivity();
738
 
720
 
Line 774... Line 756...
774
        return responseSender.ok(true);
756
        return responseSender.ok(true);
775
 
757
 
776
    }
758
    }
777
 
759
 
778
    @RequestMapping(value = "/onBoardingTimelineStatus", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
760
    @RequestMapping(value = "/onBoardingTimelineStatus", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
779
    @ApiImplicitParams({
-
 
780
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
761
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
781
    public ResponseEntity<?> onBoardingTimelineStatus(HttpServletRequest request, Model model)
762
    public ResponseEntity<?> onBoardingTimelineStatus(HttpServletRequest request, Model model)
782
            throws ProfitMandiBusinessException {
763
            throws ProfitMandiBusinessException {
783
        //This userId is of dtr.users
764
        //This userId is of dtr.users
784
        int userId = (int) request.getAttribute("userId");
765
        int userId = (int) request.getAttribute("userId");
785
 
766
 
Line 813... Line 794...
813
            return responseSender.ok(true);
794
            return responseSender.ok(true);
814
        }
795
        }
815
        return responseSender.ok(false);
796
        return responseSender.ok(false);
816
    }
797
    }
817
    @RequestMapping(value = "/onBoardingTimelineVisibility", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
798
    @RequestMapping(value = "/onBoardingTimelineVisibility", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
818
    @ApiImplicitParams({
-
 
819
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
799
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
820
    public ResponseEntity<?> onBoardingTimelineVisibility(HttpServletRequest request, Model model)
800
    public ResponseEntity<?> onBoardingTimelineVisibility(HttpServletRequest request, Model model)
821
            throws ProfitMandiBusinessException {
801
            throws ProfitMandiBusinessException {
822
        int userId = (int) request.getAttribute("userId");
802
        int userId = (int) request.getAttribute("userId");
823
        UserCart uc = userAccountRepository.getUserCart(userId);
803
        UserCart uc = userAccountRepository.getUserCart(userId);
824
 
804
 
Line 835... Line 815...
835
        return responseSender.ok(status);
815
        return responseSender.ok(status);
836
 
816
 
837
    }
817
    }
838
 
818
 
839
    @RequestMapping(value = "/getPartnerTarget", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
819
    @RequestMapping(value = "/getPartnerTarget", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
840
    @ApiImplicitParams({
-
 
841
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
820
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
842
    public ResponseEntity<?> getPartnerTarget(HttpServletRequest request,
-
 
843
                                              @RequestParam String gmailId, @RequestParam String dayValue, @RequestParam ActivationType activationType)
821
    public ResponseEntity<?> getPartnerTarget(HttpServletRequest request, @RequestParam String gmailId, @RequestParam String dayValue, @RequestParam ActivationType activationType) throws ProfitMandiBusinessException {
844
            throws ProfitMandiBusinessException {
-
 
845
 
822
 
846
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
823
        AuthUser authUser = authRepository.selectByGmailId(gmailId);
847
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
824
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
848
        Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
825
        Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
849
        List<String> brands = Arrays.asList("Vivo", "Samsung", "Oppo", "Itel", "Almost New", "Others");
826
        List<String> brands = Arrays.asList("Vivo", "Samsung", "Oppo", "Itel", "Almost New", "Others");
Line 873... Line 850...
873
 
850
 
874
            }
851
            }
875
 
852
 
876
            if (fofoIdList.size() > 0) {
853
            if (fofoIdList.size() > 0) {
877
 
854
 
878
                List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
855
                List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository.selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
879
                        .selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
-
 
880
 
856
 
881
                if (!partnerDailyInvestments.isEmpty()) {
857
                if (!partnerDailyInvestments.isEmpty()) {
882
                    partnerDailyInvestmentMap = partnerDailyInvestments.stream()
858
                    partnerDailyInvestmentMap = partnerDailyInvestments.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
883
                            .collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
-
 
884
                }
859
                }
885
 
860
 
886
                Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
861
                Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
887
 
862
 
888
                Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
863
                Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().map(x -> customRetailerMap.get(x))
Line 900... Line 875...
900
                            .filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
875
                            .filter(x -> x.getCreateTimestamp().toLocalDate().equals(LocalDate.now()))
901
                            .collect(Collectors.counting());
876
                            .collect(Collectors.counting());
902
 
877
 
903
                }
878
                }
904
 
879
 
905
                Map<Integer, PartnerCollectionPlanModel> collectionMap = partnerCollectionService
880
                Map<Integer, PartnerCollectionPlanModel> collectionMap = partnerCollectionService.getCollectionMap(fofoIdList, startDate);
906
                        .getCollectionMap(fofoIdList, startDate);
-
 
907
 
881
 
908
                Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondaryPlans = orderRepository
882
                Map<Integer, List<PartnerSecondaryPlanModel>> partnerSecondaryPlans = orderRepository
909
                        .selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
883
                        .selectPartnerSecondaryGroupByBrand(fofoIdList, startDate.toLocalDate()).stream()
910
                        .collect(Collectors.groupingBy(x -> x.getFofoId()));
884
                        .collect(Collectors.groupingBy(x -> x.getFofoId()));
911
 
885
 
Line 949... Line 923...
949
                            } else {
923
                            } else {
950
                                targetCollection = collectionPlan.getTargetPlan();
924
                                targetCollection = collectionPlan.getTargetPlan();
951
                            }
925
                            }
952
 
926
 
953
                            if (authId != null && authId == authUser.getId()) {
927
                            if (authId != null && authId == authUser.getId()) {
954
 
-
 
955
                                if (!collectionPlan.getCommittedDate().isAfter(startDate)) {
928
                                if (!collectionPlan.getCommittedDate().isAfter(startDate)) {
956
                                    totalPartnerTargetCollection += targetCollection;
929
                                    totalPartnerTargetCollection += targetCollection;
957
                                }
930
                                }
958
                            }
931
                            }
959
 
-
 
960
                            ptam.setCollectionTarget(targetCollection);
932
                            ptam.setCollectionTarget(targetCollection);
961
 
-
 
962
                            if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null
933
                            if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null
963
                                    && collectionPlan.getWalletTimestamp() != null
934
                                    && collectionPlan.getWalletTimestamp() != null
964
                                    && collectionPlan.getWalletTimestamp().toLocalDate().equals(startDate.toLocalDate())) {
935
                                    && collectionPlan.getWalletTimestamp().toLocalDate().equals(startDate.toLocalDate())) {
965
                                if (authId != null && authId == authUser.getId()) {
936
                                if (authId != null && authId == authUser.getId()) {
966
 
-
 
967
                                    totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
937
                                    totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
968
                                }
938
                                }
969
                                ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
939
                                ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
970
                            } else if (collectionPlan.getCommittedDate().toLocalDate().isEqual(startDate.toLocalDate())
940
                            } else if (collectionPlan.getCommittedDate().toLocalDate().isEqual(startDate.toLocalDate())
971
                                    && collectionPlan.getAchievementPlan() != null) {
941
                                    && collectionPlan.getAchievementPlan() != null) {
972
                                if (authId != null && authId == authUser.getId()) {
942
                                if (authId != null && authId == authUser.getId()) {
973
 
-
 
974
                                    totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
943
                                    totalPartnerAchievementCollection += collectionPlan.getAchievementPlan();
975
                                }
944
                                }
976
                                ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
945
                                ptam.setCollectionAchievement(collectionPlan.getAchievementPlan());
977
 
946
 
978
                            }
947
                            }
Line 1041... Line 1010...
1041
 
1010
 
1042
                        if (secondaryModelMap.containsKey("Others")) {
1011
                        if (secondaryModelMap.containsKey("Others")) {
1043
                            PartnerSecondaryPlanModel psp = secondaryModelMap.get("Others");
1012
                            PartnerSecondaryPlanModel psp = secondaryModelMap.get("Others");
1044
                            psp.setAchievementPlan(otherBrandSecondary);
1013
                            psp.setAchievementPlan(otherBrandSecondary);
1045
                        } else {
1014
                        } else {
1046
                            secondaryModelMap.put("Others", new PartnerSecondaryPlanModel(fofoId, "Others", (long) 0,
1015
                            secondaryModelMap.put("Others", new PartnerSecondaryPlanModel(fofoId, "Others", (long) 0, otherBrandSecondary, authUser.getId(), null));
1047
                                    otherBrandSecondary, authUser.getId(), null));
-
 
1048
                        }
1016
                        }
1049
                        for (String brand : brands) {
1017
                        for (String brand : brands) {
1050
                            if (!secondaryModelMap.containsKey(brand)) {
1018
                            if (!secondaryModelMap.containsKey(brand)) {
1051
                                secondaryModelMap.put(brand, new PartnerSecondaryPlanModel(fofoId, brand, (long) 0,
1019
                                secondaryModelMap.put(brand, new PartnerSecondaryPlanModel(fofoId, brand, (long) 0, (long) 0, authUser.getId(), null));
1052
                                        (long) 0, authUser.getId(), null));
-
 
1053
                            }
1020
                            }
1054
                        }
1021
                        }
1055
 
1022
 
1056
                        for (Entry<String, PartnerSecondaryPlanModel> secondaryModelEntry : secondaryModelMap.entrySet()) {
1023
                        for (Entry<String, PartnerSecondaryPlanModel> secondaryModelEntry : secondaryModelMap.entrySet()) {
1057
                            Integer authId = secondaryModelEntry.getValue().getAuthId();
1024
                            Integer authId = secondaryModelEntry.getValue().getAuthId();
Line 1093... Line 1060...
1093
                }
1060
                }
1094
                List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
1061
                List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
1095
 
1062
 
1096
                LOGGER.info("positions {}", positions);
1063
                LOGGER.info("positions {}", positions);
1097
 
1064
 
1098
                boolean isRBMAndL1 = positions.stream()
-
 
1099
                        .anyMatch(position ->
-
 
1100
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
1065
                boolean isRBMAndL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && EscalationType.L1.equals(position.getEscalationType()));
1101
                                        && EscalationType.L1.equals(position.getEscalationType()));
-
 
1102
                boolean isRBMAndNotL1 = positions.stream()
-
 
1103
                        .anyMatch(position ->
-
 
1104
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
1066
                boolean isRBMAndNotL1 = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId() && !EscalationType.L1.equals(position.getEscalationType()));
1105
                                        && !EscalationType.L1.equals(position.getEscalationType()));
-
 
1106
 
1067
 
1107
                LOGGER.info("isRBMAndL1{}", isRBMAndL1);
1068
                LOGGER.info("isRBMAndL1{}", isRBMAndL1);
1108
 
1069
 
1109
                boolean isSales = positions.stream()
-
 
1110
                        .anyMatch(position ->
-
 
1111
                                ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
1070
                boolean isSales = positions.stream().anyMatch(position -> ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
1112
 
1071
 
1113
                tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
1072
                tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
1114
                tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
1073
                tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
1115
                tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
1074
                tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
1116
                tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
1075
                tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
Line 1160... Line 1119...
1160
 
1119
 
1161
    }
1120
    }
1162
 
1121
 
1163
    //TODO:Amit
1122
    //TODO:Amit
1164
    @RequestMapping(value = "/target", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
1123
    @RequestMapping(value = "/target", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
1165
    @ApiImplicitParams({
-
 
1166
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
1124
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
1167
    public ResponseEntity<?> createPartnerTarget(HttpServletRequest request,
1125
    public ResponseEntity<?> createPartnerTarget(HttpServletRequest request,
1168
                                                 @RequestBody PartnerTargetAchievementModel ptam) throws ProfitMandiBusinessException {
1126
                                                 @RequestBody PartnerTargetAchievementModel ptam) throws ProfitMandiBusinessException {
1169
 
1127
 
1170
        LOGGER.info("ptam" + ptam);
1128
        LOGGER.info("ptam" + ptam);
1171
 
1129
 
Line 1340... Line 1298...
1340
        return responseSender.ok(true);
1298
        return responseSender.ok(true);
1341
 
1299
 
1342
    }
1300
    }
1343
 
1301
 
1344
    @RequestMapping(value = "/uploadFranchiseeVisit", method = RequestMethod.POST)
1302
    @RequestMapping(value = "/uploadFranchiseeVisit", method = RequestMethod.POST)
1345
    public ResponseEntity<?> readCsvFileAndSetLead(HttpServletRequest request, @RequestPart MultipartFile multipartFile)
1303
    public ResponseEntity<?> readCsvFileAndSetLead(HttpServletRequest request, @RequestPart MultipartFile multipartFile) throws Throwable {
1346
            throws Throwable {
-
 
1347
 
1304
 
1348
        int id = (int) request.getAttribute("userId");
1305
        int id = (int) request.getAttribute("userId");
1349
 
1306
 
1350
        LOGGER.info("id" + id);
1307
        LOGGER.info("id" + id);
1351
 
1308