Subversion Repositories SmartDukaan

Rev

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

Rev 31884 Rev 33087
Line 4... Line 4...
4
import com.mongodb.DBObject;
4
import com.mongodb.DBObject;
5
import com.spice.profitmandi.common.enumuration.MessageType;
5
import com.spice.profitmandi.common.enumuration.MessageType;
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
7
import com.spice.profitmandi.common.model.*;
7
import com.spice.profitmandi.common.model.*;
8
import com.spice.profitmandi.dao.Interface.Campaign;
8
import com.spice.profitmandi.dao.Interface.Campaign;
-
 
9
import com.spice.profitmandi.dao.entity.catalog.BrandCatalog;
9
import com.spice.profitmandi.dao.entity.dtr.Document;
10
import com.spice.profitmandi.dao.entity.dtr.Document;
10
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
11
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
11
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
12
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
12
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
13
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
13
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
14
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
Line 16... Line 17...
16
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
17
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
17
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
18
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
18
import com.spice.profitmandi.dao.repository.dtr.Mongo;
19
import com.spice.profitmandi.dao.repository.dtr.Mongo;
19
import com.spice.profitmandi.dao.repository.fofo.*;
20
import com.spice.profitmandi.dao.repository.fofo.*;
20
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
21
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
-
 
22
import com.spice.profitmandi.service.catalog.BrandsService;
21
import com.spice.profitmandi.service.inventory.InventoryService;
23
import com.spice.profitmandi.service.inventory.InventoryService;
22
import org.apache.logging.log4j.LogManager;
24
import org.apache.logging.log4j.LogManager;
23
import org.apache.logging.log4j.Logger;
25
import org.apache.logging.log4j.Logger;
24
import org.springframework.beans.factory.annotation.Autowired;
26
import org.springframework.beans.factory.annotation.Autowired;
25
import org.springframework.stereotype.Component;
27
import org.springframework.stereotype.Component;
Line 68... Line 70...
68
 
70
 
69
    @Autowired
71
    @Autowired
70
    DocumentRepository documentRepository;
72
    DocumentRepository documentRepository;
71
 
73
 
72
    @Autowired
74
    @Autowired
-
 
75
    BrandsService brandsService;
-
 
76
 
-
 
77
    @Autowired
73
    CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
78
    CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
74
 
79
 
75
    private static final Logger LOGGER = LogManager.getLogger(FofoUser.class);
80
    private static final Logger LOGGER = LogManager.getLogger(FofoUser.class);
76
 
81
 
77
    List<String> colorList = Arrays.asList("papayawhip", "mediumseagreen", "dodgerblue", "darkblue", "gold", "#eb0029", "coral", "steelblue", "red", "deeppink", "midnightblue", "cornsilk");
82
    List<String> colorList = Arrays.asList("papayawhip", "mediumseagreen", "dodgerblue", "darkblue", "gold", "#eb0029", "coral", "steelblue", "red", "deeppink", "midnightblue", "cornsilk");
Line 110... Line 115...
110
 
115
 
111
    }
116
    }
112
 
117
 
113
    public List<BrandStockPrice> getBrandStockPrices(int fofoId, boolean allBrands) throws Exception {
118
    public List<BrandStockPrice> getBrandStockPrices(int fofoId, boolean allBrands) throws Exception {
114
        Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
119
        Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
115
 
-
 
116
        List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
-
 
117
        List<BrandStockPrice> brandStockPrices = new ArrayList<>();
120
        List<BrandStockPrice> brandStockPrices = new ArrayList<>();
118
 
-
 
-
 
121
        List<BrandCatalog> mobileBrands = brandsService.getBrands(fofoId, null, 3);
119
        mobileBrands.stream().forEach(x -> {
122
        mobileBrands.stream().forEach(x -> {
120
            String brand = (String) x.get("name");
-
 
121
            if (brandStockPricesMap.containsKey(brand)) {
123
            if (brandStockPricesMap.containsKey(x.getName())) {
122
                BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
124
                BrandStockPrice brandStockPrice = brandStockPricesMap.get(x.getName());
123
                brandStockPrice.setBrandUrl((String) x.get("url"));
125
                brandStockPrice.setBrandUrl((String) x.getLogoUrl());
124
                brandStockPrice.setRank(((Double) x.get("rank")).intValue());
126
                brandStockPrice.setRank(x.getBrandCategory().getRank());
125
                brandStockPrices.add(brandStockPrice);
127
                brandStockPrices.add(brandStockPrice);
126
            }
128
            }
127
        });
129
        });
128
 
130
 
129
        if (allBrands) {
131
        if (allBrands) {