Subversion Repositories SmartDukaan

Rev

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

Rev 23902 Rev 23903
Line 10... Line 10...
10
import java.util.stream.Collectors;
10
import java.util.stream.Collectors;
11
 
11
 
12
import org.apache.commons.lang.StringUtils;
12
import org.apache.commons.lang.StringUtils;
13
import org.apache.logging.log4j.LogManager;
13
import org.apache.logging.log4j.LogManager;
14
import org.apache.logging.log4j.Logger;
14
import org.apache.logging.log4j.Logger;
-
 
15
import org.apache.poi.util.SystemOutLogger;
15
import org.springframework.beans.factory.annotation.Autowired;
16
import org.springframework.beans.factory.annotation.Autowired;
16
import org.springframework.stereotype.Component;
17
import org.springframework.stereotype.Component;
17
import org.springframework.transaction.annotation.Transactional;
18
import org.springframework.transaction.annotation.Transactional;
18
 
19
 
19
import com.spice.profitmandi.common.model.CustomRetailer;
20
import com.spice.profitmandi.common.model.CustomRetailer;
Line 129... Line 130...
129
				"Code\tStoreName\tEmail\tMobile\tminimumInvestment\twalletAmount\tinStockAmount\tunbilledStockAmount\tgrnPendingStockAmount\tTotalInvested");
130
				"Code\tStoreName\tEmail\tMobile\tminimumInvestment\twalletAmount\tinStockAmount\tunbilledStockAmount\tgrnPendingStockAmount\tTotalInvested");
130
		List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
131
		List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
131
		Map<Integer, CustomRetailer> customRetailerMap = retailerService
132
		Map<Integer, CustomRetailer> customRetailerMap = retailerService
132
				.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
133
				.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
133
		for (FofoStore fofoStore : fofoStores) {
134
		for (FofoStore fofoStore : fofoStores) {
134
			CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
-
 
135
			float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
-
 
136
			float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
-
 
137
 
-
 
138
			float unbilledStockAmount = 0;
-
 
139
			List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
-
 
140
			for (Order unBilledOrder : unbilledOrders) {
-
 
141
				unbilledStockAmount += unBilledOrder.getTotalAmount();
-
 
142
			}
-
 
143
 
-
 
144
			float grnPendingStockAmount = 0;
-
 
145
			List<Order> grnPendingOrders = transactionService.getGrnPendingOrders(fofoStore.getId());
-
 
146
			for (Order grnPendingOrder : grnPendingOrders) {
-
 
147
				grnPendingStockAmount += grnPendingOrder.getTotalAmount();
-
 
148
			}
-
 
149
			float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
-
 
150
			try {
135
			try {
-
 
136
				CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
-
 
137
				float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
-
 
138
				float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
-
 
139
 
-
 
140
				float unbilledStockAmount = 0;
-
 
141
				List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
-
 
142
				for (Order unBilledOrder : unbilledOrders) {
-
 
143
					unbilledStockAmount += unBilledOrder.getTotalAmount();
-
 
144
				}
-
 
145
 
-
 
146
				float grnPendingStockAmount = 0;
-
 
147
				List<Order> grnPendingOrders = transactionService.getGrnPendingOrders(fofoStore.getId());
-
 
148
				for (Order grnPendingOrder : grnPendingOrders) {
-
 
149
					grnPendingStockAmount += grnPendingOrder.getTotalAmount();
-
 
150
				}
-
 
151
				float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
-
 
152
				LOGGER.info(
151
				LOGGER.info(String.join("\t", fofoStore.getCode(), retailer.getBusinessName(), retailer.getMobileNumber(),
153
						String.join("\t", fofoStore.getCode(), retailer.getBusinessName(), retailer.getMobileNumber(),
152
						String.valueOf(fofoStore.getMinimumInvestment()), String.valueOf(walletAmount),
154
								String.valueOf(fofoStore.getMinimumInvestment()), String.valueOf(walletAmount),
153
						String.valueOf(inStockAmount), String.valueOf(unbilledStockAmount),
155
								String.valueOf(inStockAmount), String.valueOf(unbilledStockAmount),
154
						String.valueOf(grnPendingStockAmount), String.valueOf(totalInvestedAmount)));
156
								String.valueOf(grnPendingStockAmount), String.valueOf(totalInvestedAmount)));
155
			} catch (Exception e) {
157
			} catch (Exception e) {
-
 
158
				e.printStackTrace();
156
				continue;
159
				continue;
157
			}
160
			}
158
		}
161
		}
159
 
162
 
160
	}
163
	}