Subversion Repositories SmartDukaan

Rev

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

Rev 33041 Rev 34118
Line 176... Line 176...
176
    private TicketAssignedRepository ticketAssignedRepository;
176
    private TicketAssignedRepository ticketAssignedRepository;
177
 
177
 
178
    @RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
178
    @RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
179
    @ApiImplicitParams({
179
    @ApiImplicitParams({
180
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
180
            @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
-
 
181
 
181
    public ResponseEntity<?> LeadUser(HttpServletRequest request,
182
    public ResponseEntity<?> LeadUser(@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
182
                                      @RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
183
        LOGGER.info("CreateRefferalRequest - " + createRefferalRequest);
183
        Lead lead = new Lead();
184
        Lead lead = new Lead();
184
        lead.setFirstName(createRefferalRequest.getFirstName());
185
        lead.setFirstName(createRefferalRequest.getFirstName());
185
        lead.setLastName(createRefferalRequest.getLastName());
186
        lead.setLastName(createRefferalRequest.getLastName());
186
        lead.setLeadMobile(createRefferalRequest.getMobile());
187
        lead.setLeadMobile(createRefferalRequest.getMobile());
187
        lead.setState(createRefferalRequest.getState());
188
        lead.setState(createRefferalRequest.getState());
Line 202... Line 203...
202
        lead.setCreatedBy(authUserName);
203
        lead.setCreatedBy(authUserName);
203
        lead.setAuthId(authUser.getId());
204
        lead.setAuthId(authUser.getId());
204
        lead.setAssignTo(authUser.getId());
205
        lead.setAssignTo(authUser.getId());
205
 
206
 
206
        leadRepository.persist(lead);
207
        leadRepository.persist(lead);
-
 
208
 
-
 
209
        LeadDetailModel leadDetail = new LeadDetailModel();
-
 
210
        leadDetail.setLeadId(lead.getId());
-
 
211
        leadDetail.setOutletName("");
-
 
212
        leadDetail.setCounterSize(0);
-
 
213
 
-
 
214
 
-
 
215
        leadDetail.setFrontp(createRefferalRequest.getFrontp());
-
 
216
        leadDetail.setFrontWithMarket(createRefferalRequest.getFrontWithMarket());
-
 
217
 
-
 
218
 
-
 
219
        leadDetail.setInternalLongShot(createRefferalRequest.getInternalLongShot());
-
 
220
 
-
 
221
        leadDetail.setInternalLeftWall(createRefferalRequest.getInternalLeftWall());
-
 
222
 
-
 
223
        leadDetail.setInternalRightWall(createRefferalRequest.getInternalRightWall());
-
 
224
        List<LeadBrandModel> brandModels = new ArrayList<LeadBrandModel>();
-
 
225
        List<LeadBrandModel> leadBrands = createRefferalRequest.getLeadBrands();
-
 
226
 
-
 
227
        if (leadBrands==null) {
-
 
228
            leadBrands = new ArrayList<>();
-
 
229
        }
-
 
230
 
-
 
231
        for (LeadBrandModel leadBrandModel : leadBrands) {
-
 
232
 
-
 
233
            LeadBrandModel leadBrand = new LeadBrandModel();
-
 
234
            leadBrand.setBrand(leadBrandModel.getBrand());
-
 
235
            leadBrand.setValue(leadBrandModel.getValue());
-
 
236
 
-
 
237
            brandModels.add(leadBrand);
-
 
238
 
-
 
239
        }
-
 
240
 
-
 
241
        leadDetail.setLeadBrands(brandModels);
-
 
242
        if (!lead.getStatus().equals(LeadStatus.notInterested)) {
-
 
243
            leadRepository.persistLeadDetail(leadDetail, authUser);
-
 
244
        }
-
 
245
 
207
        LeadActivity leadActivity = new LeadActivity();
246
        LeadActivity leadActivity = new LeadActivity();
208
        leadActivity.setLeadId(lead.getId());
247
        leadActivity.setLeadId(lead.getId());
209
        leadActivity.setRemark(createRefferalRequest.getRemark());
248
        leadActivity.setRemark(createRefferalRequest.getRemark());
210
 
249
 
211
        leadActivity.setAuthId(authUser.getId());
250
        leadActivity.setAuthId(authUser.getId());
Line 980... Line 1019...
980
                LOGGER.info("positions {}", positions);
1019
                LOGGER.info("positions {}", positions);
981
 
1020
 
982
                boolean isRBMAndL1 = positions.stream()
1021
                boolean isRBMAndL1 = positions.stream()
983
                        .anyMatch(position ->
1022
                        .anyMatch(position ->
984
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
1023
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
985
                                        &&  EscalationType.L1.equals(position.getEscalationType()));
1024
                                        && EscalationType.L1.equals(position.getEscalationType()));
986
                boolean isRBMAndNotL1 = positions.stream()
1025
                boolean isRBMAndNotL1 = positions.stream()
987
                        .anyMatch(position ->
1026
                        .anyMatch(position ->
988
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
1027
                                ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
989
                                        &&  !EscalationType.L1.equals(position.getEscalationType()));
1028
                                        && !EscalationType.L1.equals(position.getEscalationType()));
990
 
1029
 
991
                LOGGER.info("isRBMAndL1{}",isRBMAndL1);
1030
                LOGGER.info("isRBMAndL1{}", isRBMAndL1);
992
 
1031
 
993
                boolean isSales = positions.stream()
1032
                boolean isSales = positions.stream()
994
                        .anyMatch(position ->
1033
                        .anyMatch(position ->
995
                                ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
1034
                                ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
996
 
1035