Subversion Repositories SmartDukaan

Rev

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

Rev 34084 Rev 34158
Line 143... Line 143...
143
    @Override
143
    @Override
144
    public TicketActivityMedia createMediaActivity(ActivityMediaModel selectedRecording) {
144
    public TicketActivityMedia createMediaActivity(ActivityMediaModel selectedRecording) {
145
        TicketActivityMedia activity = new TicketActivityMedia();
145
        TicketActivityMedia activity = new TicketActivityMedia();
146
        activity.setMobile(selectedRecording.getMobile());
146
        activity.setMobile(selectedRecording.getMobile());
147
        // add a prefix endpoint of mediaUrl
147
        // add a prefix endpoint of mediaUrl
148
       // String customValue = "https://ccs1.smartpingcc.io/v2/recording/direct/71287091";
148
        // String customValue = "https://ccs1.smartpingcc.io/v2/recording/direct/71287091";
149
        activity.setMediaUrl(selectedRecording.getMediaUrl());
149
        activity.setMediaUrl(selectedRecording.getMediaUrl());
150
        activity.setDurationInSec(selectedRecording.getDurationInSec());
150
        activity.setDurationInSec(selectedRecording.getDurationInSec());
151
        activity.setCallTime(selectedRecording.getCallConnectTime());
151
        activity.setCallTime(selectedRecording.getCallConnectTime());
152
        activity.setCreatedBy(0);
152
        activity.setCreatedBy(0);
153
        activity.setCreateTimestamp(LocalDateTime.now());
153
        activity.setCreateTimestamp(LocalDateTime.now());
Line 279... Line 279...
279
            this.addActivity(ticket, this.createActivity(ActivityType.ASSIGNED, "Ticket assigned to " + authUser.getName(), 0));
279
            this.addActivity(ticket, this.createActivity(ActivityType.ASSIGNED, "Ticket assigned to " + authUser.getName(), 0));
280
        }
280
        }
281
    }
281
    }
282
 
282
 
283
    public void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType) throws ProfitMandiBusinessException {
283
    public void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType) throws ProfitMandiBusinessException {
284
        this.updateTicket(categoryId,subCategoryId,ticket,authUserId,escalationType,null);
284
        this.updateTicket(categoryId, subCategoryId, ticket, authUserId, escalationType, null);
285
    }
285
    }
286
 
286
 
287
    @Override
287
    @Override
288
    public void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType, ActivityMediaModel recording) throws ProfitMandiBusinessException {
288
    public void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType, ActivityMediaModel recording) throws ProfitMandiBusinessException {
289
 
289
 
Line 309... Line 309...
309
                LOGGER.info("Could not send mail for ticket {}", ticket.toString());
309
                LOGGER.info("Could not send mail for ticket {}", ticket.toString());
310
            }
310
            }
311
 
311
 
312
            Activity categoryChangedActivity = this.createActivity(ActivityType.CATEGORY_CHANGED, "Category changed to " + ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName(), 0);
312
            Activity categoryChangedActivity = this.createActivity(ActivityType.CATEGORY_CHANGED, "Category changed to " + ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName(), 0);
313
            this.addActivity(ticket, categoryChangedActivity);
313
            this.addActivity(ticket, categoryChangedActivity);
314
            if(recording != null){
314
            if (recording != null) {
315
                this.addMediaActivity(ticket, this.createMediaActivity(recording));
315
                this.addMediaActivity(ticket, this.createMediaActivity(recording));
316
            }
316
            }
317
 
317
 
318
 
318
 
319
        }
319
        }
Line 705... Line 705...
705
    public Map<Integer, List<Integer>> authUserpartnerIdMap(int authId, int categoryId) {
705
    public Map<Integer, List<Integer>> authUserpartnerIdMap(int authId, int categoryId) {
706
        Session session = sessionFactory.getCurrentSession();
706
        Session session = sessionFactory.getCurrentSession();
707
 
707
 
708
        Map<Integer, List<Integer>> authUserpartnerIdMap = new HashMap<>();
708
        Map<Integer, List<Integer>> authUserpartnerIdMap = new HashMap<>();
709
 
709
 
710
        List<Position> authPositions = positionRepository.selectPositionbyCategoryIdAndAuthId(categoryId,authId);
710
        List<Position> authPositions = positionRepository.selectPositionbyCategoryIdAndAuthId(categoryId, authId);
711
 
711
 
712
        List<PartnerPosition> partnerPositions = authPositions.stream()
712
        List<PartnerPosition> partnerPositions = authPositions.stream()
713
                .flatMap(authPosition -> partnerPositionRepository.selectByPositionId(authPosition.getId()).stream())
713
                .flatMap(authPosition -> partnerPositionRepository.selectByPositionId(authPosition.getId()).stream())
714
                .collect(Collectors.toList());
714
                .collect(Collectors.toList());
715
 
715
 
Line 720... Line 720...
720
                    .map(FofoStore::getId) // Extract the IDs of FofoStores
720
                    .map(FofoStore::getId) // Extract the IDs of FofoStores
721
                    .collect(Collectors.toList());
721
                    .collect(Collectors.toList());
722
 
722
 
723
            authUserpartnerIdMap.put(authId, fofoStoreIds);
723
            authUserpartnerIdMap.put(authId, fofoStoreIds);
724
 
724
 
725
         } else {
725
        } else {
726
            final TypedQuery<AuthUserPartnerMapModel> typedQuerySimilar = session
726
            final TypedQuery<AuthUserPartnerMapModel> typedQuerySimilar = session
727
                    .createNamedQuery("Position.Auth_User_Partner_Maping", AuthUserPartnerMapModel.class);
727
                    .createNamedQuery("Position.Auth_User_Partner_Maping", AuthUserPartnerMapModel.class);
728
 
728
 
729
            typedQuerySimilar.setParameter("authId", authId);
729
            typedQuerySimilar.setParameter("authId", authId);
730
            typedQuerySimilar.setParameter("categoryId", categoryId);
730
            typedQuerySimilar.setParameter("categoryId", categoryId);
Line 1027... Line 1027...
1027
        }
1027
        }
1028
 
1028
 
1029
    }
1029
    }
1030
 
1030
 
1031
 
1031
 
1032
 
-
 
1033
    @Override
1032
    @Override
1034
    @Cacheable(value = "partnerSaleHeader", cacheManager = "oneDayCacheManager")
1033
    @Cacheable(value = "partnerSaleHeader", cacheManager = "oneDayCacheManager")
1035
    public Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
1034
    public Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
1036
        Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
1035
        Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
1037
 
1036
 
Line 1078... Line 1077...
1078
            String code = customRetailer.getCode();
1077
            String code = customRetailer.getCode();
1079
            // String storeName = "SmartDukaan-" +
1078
            // String storeName = "SmartDukaan-" +
1080
            // fofoStore.getCode().replaceAll("[a-zA-Z]", "");
1079
            // fofoStore.getCode().replaceAll("[a-zA-Z]", "");
1081
            String businessName = customRetailer.getBusinessName();
1080
            String businessName = customRetailer.getBusinessName();
1082
            try {
1081
            try {
1083
                String stateManager = StringUtils.join(partnerEmailSalesMap.get(customRetailer.getEmail()).getL2(), ", ");
1082
                String stateManager = StringUtils.join(new HashSet(partnerEmailSalesMap.get(customRetailer.getEmail()).getL2()), ", ");
1084
                String territoryManager = StringUtils.join(partnerEmailSalesMap.get(customRetailer.getEmail()).getL1(), ", ");
1083
                String territoryManager = StringUtils.join(new HashSet(partnerEmailSalesMap.get(customRetailer.getEmail()).getL1()), ", ");
1085
 
1084
 
1086
                if (StringUtils.isEmpty(territoryManager)) {
1085
                if (StringUtils.isEmpty(territoryManager)) {
1087
                    territoryManager = StringUtils.join(partnerEmailSalesMap.get(customRetailer.getEmail()).getL2(), ", ");
1086
                    territoryManager = StringUtils.join(new HashSet(partnerEmailSalesMap.get(customRetailer.getEmail()).getL2()), ", ");
1088
                }
1087
                }
1089
 
1088
 
1090
                FofoReportingModel reportingModel = new FofoReportingModel();
1089
                FofoReportingModel reportingModel = new FofoReportingModel();
1091
                reportingModel.setBusinessName(businessName);
1090
                reportingModel.setBusinessName(businessName);
1092
                reportingModel.setCode(code);
1091
                reportingModel.setCode(code);
Line 1174... Line 1173...
1174
        Set<CustomRetailer> allCrList = new HashSet<>();
1173
        Set<CustomRetailer> allCrList = new HashSet<>();
1175
        for (List<CustomRetailer> cr : positionIdRetailerMap.values()) {
1174
        for (List<CustomRetailer> cr : positionIdRetailerMap.values()) {
1176
            allCrList.addAll(cr);
1175
            allCrList.addAll(cr);
1177
        }
1176
        }
1178
 
1177
 
1179
        Map<Integer, FofoStore> fofoStoresMap = fofoStoreRepository.selectActiveStores().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
-
 
1180
 
1178
 
1181
        Map<Integer, FofoRBMReportingModel> partnerIdRbmHeadersMap = new HashMap<>();
1179
        Map<Integer, FofoRBMReportingModel> partnerIdRbmHeadersMap = new HashMap<>();
1182
 
1180
 
1183
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
1181
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
1184
        for (Map.Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
1182
        for (Map.Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {