| Line 29... |
Line 29... |
| 29 |
import org.springframework.ui.Model;
|
29 |
import org.springframework.ui.Model;
|
| 30 |
import org.springframework.web.bind.annotation.RequestMapping;
|
30 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 31 |
import org.springframework.web.bind.annotation.RequestMethod;
|
31 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 32 |
import org.springframework.web.bind.annotation.RequestParam;
|
32 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 33 |
|
33 |
|
| - |
|
34 |
import com.mongodb.DBObject;
|
| 34 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
35 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
| 35 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
36 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
37 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
| 36 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
38 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 37 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
39 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 38 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
40 |
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
|
| 39 |
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
|
41 |
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
|
| 40 |
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
|
42 |
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
|
| 41 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
- |
|
| 42 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
43 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 43 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
44 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 44 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
45 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 45 |
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
|
46 |
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
|
| 46 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
47 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 47 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
48 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 48 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
49 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
| 49 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| - |
|
51 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
| 51 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
53 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
| 52 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
54 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 53 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
55 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 54 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
- |
|
| 55 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
56 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 56 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
- |
|
| 57 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
57 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 58 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
58 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 59 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
59 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 60 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
- |
|
| 61 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
60 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 62 |
import com.spice.profitmandi.service.wallet.WalletService;
|
- |
|
| 63 |
import com.spice.profitmandi.web.model.LoginDetails;
|
61 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 64 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
62 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 65 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
63 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 66 |
|
64 |
|
| 67 |
@Controller
|
65 |
@Controller
|
| Line 106... |
Line 104... |
| 106 |
@Autowired
|
104 |
@Autowired
|
| 107 |
private RechargeTransactionRepository rechargeTransactionRepository;
|
105 |
private RechargeTransactionRepository rechargeTransactionRepository;
|
| 108 |
|
106 |
|
| 109 |
@Autowired
|
107 |
@Autowired
|
| 110 |
private TransactionService transactionService;
|
108 |
private TransactionService transactionService;
|
| - |
|
109 |
|
| - |
|
110 |
@Autowired
|
| - |
|
111 |
private InventoryService inventoryService;
|
| 111 |
|
112 |
|
| 112 |
@Autowired
|
113 |
@Autowired
|
| 113 |
private MVCResponseSender mvcResponseSender;
|
114 |
private MVCResponseSender mvcResponseSender;
|
| 114 |
|
115 |
|
| 115 |
@Autowired
|
116 |
@Autowired
|
| Line 121... |
Line 122... |
| 121 |
@Autowired
|
122 |
@Autowired
|
| 122 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
123 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| 123 |
|
124 |
|
| 124 |
@Autowired
|
125 |
@Autowired
|
| 125 |
private InsuranceProviderRepository insuranceProviderRepository;
|
126 |
private InsuranceProviderRepository insuranceProviderRepository;
|
| - |
|
127 |
|
| - |
|
128 |
@Autowired
|
| - |
|
129 |
private Mongo mongoClient;
|
| 126 |
|
130 |
|
| 127 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
131 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 128 |
|
132 |
|
| 129 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
133 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 130 |
public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
134 |
public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| Line 241... |
Line 245... |
| 241 |
.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
|
245 |
.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
|
| 242 |
|
246 |
|
| 243 |
} catch (Exception e) {
|
247 |
} catch (Exception e) {
|
| 244 |
LOGGER.error("partner Investment can't exists");
|
248 |
LOGGER.error("partner Investment can't exists");
|
| 245 |
}
|
249 |
}
|
| - |
|
250 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(loginDetails.getFofoId());
|
| - |
|
251 |
List<DBObject> mobileBrands = mongoClient.getMongoBrands(loginDetails.getFofoId(), loginDetails.getEmailId(), 3);
|
| - |
|
252 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
| - |
|
253 |
mobileBrands.stream().forEach(x->{
|
| - |
|
254 |
String brand = (String)x.get("brand");
|
| - |
|
255 |
if(brandStockPricesMap.containsKey(brand)) {
|
| - |
|
256 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
| - |
|
257 |
brandStockPrice.setBrandUrl((String)x.get("url"));
|
| - |
|
258 |
brandStockPrice.setRank((int)x.get("rank"));
|
| - |
|
259 |
brandStockPrices.add(brandStockPrice);
|
| - |
|
260 |
} else {
|
| - |
|
261 |
}
|
| - |
|
262 |
});
|
| - |
|
263 |
model.addAttribute("brandStockPrices", brandStockPrices.stream().sorted((x,y)-> y.getRank() - x.getRank()).collect(Collectors.toList()));
|
| 246 |
model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
|
264 |
model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 247 |
model.addAttribute("partnerInvestment", partnerInvestments.get(0));
|
265 |
model.addAttribute("partnerInvestment", partnerInvestments.get(0));
|
| 248 |
model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
|
266 |
//model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
|
| 249 |
model.addAttribute("fofoStore", fofoStore);
|
267 |
model.addAttribute("fofoStore", fofoStore);
|
| 250 |
model.addAttribute("walletAmount");
|
268 |
model.addAttribute("walletAmount");
|
| 251 |
model.addAttribute("appContextPath", request.getContextPath());
|
269 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 252 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
270 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 253 |
model.addAttribute("webApiHost", webApiHost);
|
271 |
model.addAttribute("webApiHost", webApiHost);
|