Subversion Repositories SmartDukaan

Rev

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

Rev 34077 Rev 34082
Line 9... Line 9...
9
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
9
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
10
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
10
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
11
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
11
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
12
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
12
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
13
import com.spice.profitmandi.dao.model.ActivityMediaModel;
13
import com.spice.profitmandi.dao.model.ActivityMediaModel;
-
 
14
import com.spice.profitmandi.dao.model.AuthUserPartnerMapModel;
14
import com.spice.profitmandi.dao.model.FofoRBMReportingModel;
15
import com.spice.profitmandi.dao.model.FofoRBMReportingModel;
15
import com.spice.profitmandi.dao.model.FofoReportingModel;
16
import com.spice.profitmandi.dao.model.FofoReportingModel;
16
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
17
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
17
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
18
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
18
import com.spice.profitmandi.service.user.RetailerService;
19
import com.spice.profitmandi.service.user.RetailerService;
19
import org.apache.commons.collections4.map.HashedMap;
20
import org.apache.commons.collections4.map.HashedMap;
20
import org.apache.commons.lang.RandomStringUtils;
21
import org.apache.commons.lang.RandomStringUtils;
21
import org.apache.commons.lang.StringUtils;
22
import org.apache.commons.lang.StringUtils;
22
import org.apache.logging.log4j.LogManager;
23
import org.apache.logging.log4j.LogManager;
23
import org.apache.logging.log4j.Logger;
24
import org.apache.logging.log4j.Logger;
-
 
25
import org.hibernate.Session;
-
 
26
import org.hibernate.SessionFactory;
24
import org.springframework.beans.factory.annotation.Autowired;
27
import org.springframework.beans.factory.annotation.Autowired;
25
import org.springframework.cache.annotation.Cacheable;
28
import org.springframework.cache.annotation.Cacheable;
26
import org.springframework.mail.javamail.JavaMailSender;
29
import org.springframework.mail.javamail.JavaMailSender;
27
import org.springframework.stereotype.Component;
30
import org.springframework.stereotype.Component;
28
 
31
 
-
 
32
import javax.persistence.TypedQuery;
29
import java.time.LocalDateTime;
33
import java.time.LocalDateTime;
30
import java.util.*;
34
import java.util.*;
31
import java.util.stream.Collectors;
35
import java.util.stream.Collectors;
32
 
36
 
33
@Component
37
@Component
Line 82... Line 86...
82
    private PartnerPositionRepository partnerPositionRepository;
86
    private PartnerPositionRepository partnerPositionRepository;
83
 
87
 
84
    @Autowired
88
    @Autowired
85
    private FofoStoreRepository fofoStoreRepository;
89
    private FofoStoreRepository fofoStoreRepository;
86
 
90
 
-
 
91
    @Autowired
-
 
92
    private SessionFactory sessionFactory;
-
 
93
 
87
    @Override
94
    @Override
88
    public void createTicket(int fofoId, int categoryId, int subcategoryId, String message) throws ProfitMandiBusinessException {
95
    public void createTicket(int fofoId, int categoryId, int subcategoryId, String message) throws ProfitMandiBusinessException {
89
        this.createTicket(fofoId, categoryId, subcategoryId, message, 0);
96
        this.createTicket(fofoId, categoryId, subcategoryId, message, 0);
90
    }
97
    }
91
 
98
 
Line 693... Line 700...
693
        }
700
        }
694
        return authUserPartnerMap;
701
        return authUserPartnerMap;
695
    }
702
    }
696
 
703
 
697
    @Override
704
    @Override
-
 
705
    public Map<Integer, List<Integer>> authUserpartnerIdMap(int authId, int categoryId) {
-
 
706
        Session session = sessionFactory.getCurrentSession();
-
 
707
 
-
 
708
        final TypedQuery<AuthUserPartnerMapModel> typedQuerySimilar = session
-
 
709
                .createNamedQuery("Position.Auth_User_Partner_Maping", AuthUserPartnerMapModel.class);
-
 
710
 
-
 
711
        typedQuerySimilar.setParameter("authId", authId);
-
 
712
        typedQuerySimilar.setParameter("categoryId", categoryId);
-
 
713
 
-
 
714
        List<AuthUserPartnerMapModel> authUserPartnerMapModels = typedQuerySimilar.getResultList();
-
 
715
        LOGGER.info("authUserPartnerMapModels {}", authUserPartnerMapModels);
-
 
716
 
-
 
717
        Map<Integer, List<Integer>> authUserpartnerIdMap = authUserPartnerMapModels.stream()
-
 
718
                .collect(Collectors.groupingBy(
-
 
719
                        AuthUserPartnerMapModel::getAuthId,
-
 
720
                        Collectors.mapping(AuthUserPartnerMapModel::getFofoId, Collectors.toList())
-
 
721
                ));
-
 
722
        LOGGER.info("partnerusermap {}", authUserpartnerIdMap);
-
 
723
 
-
 
724
        return authUserpartnerIdMap;
-
 
725
    }
-
 
726
 
-
 
727
    @Override
698
    public List<String> getAuthUserByPartnerId(int fofoId) throws ProfitMandiBusinessException {
728
    public List<String> getAuthUserByPartnerId(int fofoId) throws ProfitMandiBusinessException {
699
 
729
 
700
        List<String> emails = new ArrayList<>();
730
        List<String> emails = new ArrayList<>();
701
        List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId()).collect(Collectors.toList());
731
        List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId()).collect(Collectors.toList());
702
 
732