| 23724 |
amit.gupta |
1 |
package com.smartdukaan.cron.scheduled;
|
| 23723 |
amit.gupta |
2 |
|
| 24121 |
govind |
3 |
import java.io.IOException;
|
|
|
4 |
import java.io.InputStream;
|
| 23739 |
amit.gupta |
5 |
import java.sql.Timestamp;
|
| 24174 |
govind |
6 |
import java.text.MessageFormat;
|
| 23724 |
amit.gupta |
7 |
import java.time.LocalDate;
|
|
|
8 |
import java.time.LocalDateTime;
|
| 24256 |
amit.gupta |
9 |
import java.time.LocalTime;
|
| 23724 |
amit.gupta |
10 |
import java.time.temporal.ChronoUnit;
|
|
|
11 |
import java.util.ArrayList;
|
|
|
12 |
import java.util.Arrays;
|
| 23723 |
amit.gupta |
13 |
import java.util.HashMap;
|
| 24241 |
amit.gupta |
14 |
import java.util.HashSet;
|
| 23724 |
amit.gupta |
15 |
import java.util.List;
|
| 23723 |
amit.gupta |
16 |
import java.util.Map;
|
| 24242 |
amit.gupta |
17 |
import java.util.Optional;
|
| 23724 |
amit.gupta |
18 |
import java.util.stream.Collectors;
|
| 23723 |
amit.gupta |
19 |
|
| 24121 |
govind |
20 |
import javax.mail.MessagingException;
|
|
|
21 |
import javax.mail.internet.InternetAddress;
|
|
|
22 |
import javax.mail.internet.MimeMessage;
|
|
|
23 |
|
|
|
24 |
import org.apache.commons.codec.CharEncoding;
|
|
|
25 |
import org.apache.commons.io.IOUtils;
|
| 23929 |
amit.gupta |
26 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 23755 |
amit.gupta |
27 |
import org.apache.logging.log4j.LogManager;
|
|
|
28 |
import org.apache.logging.log4j.Logger;
|
| 24184 |
govind |
29 |
import org.apache.poi.EncryptedDocumentException;
|
|
|
30 |
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
| 23723 |
amit.gupta |
31 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23933 |
amit.gupta |
32 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 23724 |
amit.gupta |
33 |
import org.springframework.beans.factory.annotation.Value;
|
| 23929 |
amit.gupta |
34 |
import org.springframework.core.io.ByteArrayResource;
|
|
|
35 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 24121 |
govind |
36 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| 23723 |
amit.gupta |
37 |
import org.springframework.stereotype.Component;
|
| 23724 |
amit.gupta |
38 |
import org.springframework.transaction.annotation.Transactional;
|
| 23723 |
amit.gupta |
39 |
|
| 23724 |
amit.gupta |
40 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
| 24121 |
govind |
41 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 23929 |
amit.gupta |
42 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 23724 |
amit.gupta |
43 |
import com.spice.profitmandi.common.model.RechargeCredential;
|
| 24002 |
amit.gupta |
44 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 23929 |
amit.gupta |
45 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
|
|
46 |
import com.spice.profitmandi.common.util.Utils;
|
| 23724 |
amit.gupta |
47 |
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
|
|
|
48 |
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
|
|
|
49 |
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
|
|
|
50 |
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
|
|
|
51 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 23929 |
amit.gupta |
52 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 24249 |
amit.gupta |
53 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 24277 |
amit.gupta |
54 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 24174 |
govind |
55 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 23724 |
amit.gupta |
56 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
| 24174 |
govind |
57 |
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
|
| 24242 |
amit.gupta |
58 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 24241 |
amit.gupta |
59 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 24431 |
amit.gupta |
60 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 24250 |
amit.gupta |
61 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 24242 |
amit.gupta |
62 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 24249 |
amit.gupta |
63 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 24241 |
amit.gupta |
64 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
| 23724 |
amit.gupta |
65 |
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
|
| 23929 |
amit.gupta |
66 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23724 |
amit.gupta |
67 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderCreditWalletHistoryRepository;
|
|
|
68 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
|
|
|
69 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
|
|
70 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 24249 |
amit.gupta |
71 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 24277 |
amit.gupta |
72 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 24174 |
govind |
73 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| 23724 |
amit.gupta |
74 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 24242 |
amit.gupta |
75 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
| 24241 |
amit.gupta |
76 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 23929 |
amit.gupta |
77 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 24431 |
amit.gupta |
78 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 24337 |
amit.gupta |
79 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 23929 |
amit.gupta |
80 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 24271 |
amit.gupta |
81 |
import com.spice.profitmandi.service.order.OrderService;
|
| 24431 |
amit.gupta |
82 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
| 23724 |
amit.gupta |
83 |
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
|
|
|
84 |
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
|
|
|
85 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 24121 |
govind |
86 |
import com.spice.profitmandi.service.slab.TargetSlabService;
|
| 23929 |
amit.gupta |
87 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
|
|
88 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 23739 |
amit.gupta |
89 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 23723 |
amit.gupta |
90 |
|
| 24197 |
amit.gupta |
91 |
import in.shop2020.model.v1.order.WalletReferenceType;;
|
| 23739 |
amit.gupta |
92 |
|
| 23723 |
amit.gupta |
93 |
@Component
|
| 23724 |
amit.gupta |
94 |
@Transactional(rollbackFor = Throwable.class)
|
| 23723 |
amit.gupta |
95 |
public class ScheduledTasks {
|
|
|
96 |
|
| 23724 |
amit.gupta |
97 |
@Value("${oxigen.recharge.transaction.url}")
|
|
|
98 |
private String oxigenRechargeTransactionUrl;
|
| 23723 |
amit.gupta |
99 |
|
| 23724 |
amit.gupta |
100 |
@Value("${oxigen.recharge.enquiry.url}")
|
|
|
101 |
private String oxigenRechargeEnquiryUrl;
|
| 24431 |
amit.gupta |
102 |
|
|
|
103 |
@Autowired
|
|
|
104 |
private PriceDropService priceDropService;
|
| 23723 |
amit.gupta |
105 |
|
| 23724 |
amit.gupta |
106 |
@Value("${oxigen.recharge.auth.key}")
|
|
|
107 |
private String oxigenRechargeAuthKey;
|
|
|
108 |
|
|
|
109 |
@Value("${oxigen.recharge.validation.url}")
|
|
|
110 |
private String oxigenRechargeValidationUrl;
|
|
|
111 |
|
|
|
112 |
@Value("${oxigen.recharge.validation.auth.key}")
|
|
|
113 |
private String oxigenRechargeValidationAuthKey;
|
|
|
114 |
|
|
|
115 |
@Value("${think.walnut.digital.recharge.transaction.mobile.url}")
|
|
|
116 |
private String thinkWalnutDigitalRechargeTransactionMobileUrl;
|
|
|
117 |
|
|
|
118 |
@Value("${think.walnut.digital.recharge.transaction.dth.url}")
|
|
|
119 |
private String thinkWalnutDigitalRechargeTransactionDthUrl;
|
|
|
120 |
|
|
|
121 |
@Value("${think.walnut.digital.recharge.enquiry.url}")
|
|
|
122 |
private String thinkWalnutDigitalRechargeEnquiryUrl;
|
|
|
123 |
|
|
|
124 |
@Value("${think.walnut.digital.recharge.balance.url}")
|
|
|
125 |
private String thinkWalnutDigitalRechargeBalanceUrl;
|
|
|
126 |
|
|
|
127 |
@Value("${think.walnut.digital.recharge.username}")
|
|
|
128 |
private String thinkWalnutDigitalRechargeUserName;
|
|
|
129 |
|
|
|
130 |
@Value("${think.walnut.digital.recharge.password}")
|
|
|
131 |
private String thinkWalnutDigitalRechargePassword;
|
|
|
132 |
|
|
|
133 |
@Value("${think.walnut.digital.recharge.auth.key}")
|
|
|
134 |
private String thinkWalnutDigitalRechargeAuthKey;
|
|
|
135 |
|
| 23723 |
amit.gupta |
136 |
@Autowired
|
| 23724 |
amit.gupta |
137 |
private PurchaseRepository purchaseRepository;
|
|
|
138 |
|
|
|
139 |
@Autowired
|
|
|
140 |
private SchemeService schemeService;
|
|
|
141 |
|
|
|
142 |
@Autowired
|
| 24271 |
amit.gupta |
143 |
private OrderService orderService;
|
|
|
144 |
|
|
|
145 |
@Autowired
|
| 24337 |
amit.gupta |
146 |
private PartnerInvestmentService partnerInvestmentService;
|
|
|
147 |
|
|
|
148 |
@Autowired
|
| 24277 |
amit.gupta |
149 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
|
|
150 |
|
|
|
151 |
@Autowired
|
| 24241 |
amit.gupta |
152 |
private SchemeInOutRepository schemeInOutRepository;
|
|
|
153 |
|
|
|
154 |
@Autowired
|
| 23724 |
amit.gupta |
155 |
private RechargeTransactionRepository rechargeTransactionRepository;
|
|
|
156 |
|
|
|
157 |
@Autowired
|
|
|
158 |
private RechargeProviderCreditWalletHistoryRepository rechargeProviderCreditWalletHistoryRepository;
|
|
|
159 |
|
|
|
160 |
@Autowired
|
|
|
161 |
private FofoOrderRepository fofoOrderRepository;
|
| 24250 |
amit.gupta |
162 |
|
| 24249 |
amit.gupta |
163 |
@Autowired
|
|
|
164 |
private InventoryItemRepository inventoryItemRepository;
|
| 23929 |
amit.gupta |
165 |
|
| 23739 |
amit.gupta |
166 |
@Autowired
|
|
|
167 |
private WalletService walletService;
|
| 23724 |
amit.gupta |
168 |
|
|
|
169 |
@Autowired
|
|
|
170 |
private ThinkWalnutDigitalRechargeProviderService thinkWalnutDigitalRechargeProviderService;
|
|
|
171 |
|
|
|
172 |
@Autowired
|
|
|
173 |
private OxigenRechargeProviderService oxigenRechargeProviderService;
|
|
|
174 |
|
|
|
175 |
@Autowired
|
|
|
176 |
private RechargeProviderRepository rechargeProviderRepository;
|
|
|
177 |
|
|
|
178 |
@Autowired
|
| 24242 |
amit.gupta |
179 |
private ScanRecordRepository scanRecordRepository;
|
|
|
180 |
|
|
|
181 |
@Autowired
|
| 23724 |
amit.gupta |
182 |
private DailyRechargeRepository dailyRechargeRepository;
|
|
|
183 |
|
| 23929 |
amit.gupta |
184 |
@Autowired
|
|
|
185 |
private FofoStoreRepository fofoStoreRepository;
|
| 24177 |
govind |
186 |
|
| 24121 |
govind |
187 |
@Autowired
|
|
|
188 |
private TargetSlabService targetService;
|
| 23929 |
amit.gupta |
189 |
|
| 23724 |
amit.gupta |
190 |
@Value("${prod}")
|
|
|
191 |
private boolean prod;
|
|
|
192 |
|
| 23929 |
amit.gupta |
193 |
@Autowired
|
|
|
194 |
private RetailerService retailerService;
|
|
|
195 |
|
|
|
196 |
@Autowired
|
|
|
197 |
private TransactionService transactionService;
|
| 24250 |
amit.gupta |
198 |
|
| 24249 |
amit.gupta |
199 |
@Autowired
|
|
|
200 |
private ItemRepository itemRepository;
|
| 23929 |
amit.gupta |
201 |
|
|
|
202 |
@Autowired
|
|
|
203 |
private OrderRepository orderRepository;
|
|
|
204 |
|
|
|
205 |
@Autowired
|
| 24241 |
amit.gupta |
206 |
private SchemeRepository schemeRepository;
|
|
|
207 |
|
|
|
208 |
@Autowired
|
| 23929 |
amit.gupta |
209 |
private JavaMailSender mailSender;
|
| 24177 |
govind |
210 |
|
| 24174 |
govind |
211 |
@Autowired
|
| 24431 |
amit.gupta |
212 |
private PriceDropRepository priceDropRepository;
|
|
|
213 |
|
|
|
214 |
@Autowired
|
| 24174 |
govind |
215 |
private PartnerTargetRepository partnerTargetRepository;
|
| 24002 |
amit.gupta |
216 |
|
|
|
217 |
@Autowired
|
|
|
218 |
@Qualifier(value = "googleMailSender")
|
| 23932 |
amit.gupta |
219 |
private JavaMailSender googleMailSender;
|
| 23929 |
amit.gupta |
220 |
|
|
|
221 |
@Autowired
|
|
|
222 |
private InventoryService inventoryService;
|
|
|
223 |
|
| 23755 |
amit.gupta |
224 |
private static final Logger LOGGER = LogManager.getLogger(ScheduledTasks.class);
|
| 23724 |
amit.gupta |
225 |
|
|
|
226 |
public void generateDailyRecharge() {
|
|
|
227 |
List<RechargeProviderCreditWalletHistory> allCreditHistory = rechargeProviderCreditWalletHistoryRepository
|
|
|
228 |
.selectAll(0, 2000);
|
|
|
229 |
List<RechargeProvider> rechargeProviders = rechargeProviderRepository.selectAll();
|
|
|
230 |
rechargeProviders.stream().forEach(x -> x.setAmount(0));
|
|
|
231 |
|
|
|
232 |
rechargeProviders.stream().forEach(x -> {
|
|
|
233 |
Map<LocalDate, List<RechargeProviderCreditWalletHistory>> dateWiseProviderCreditsMap = allCreditHistory
|
|
|
234 |
.stream().filter(z -> z.getProviderId() == x.getId())
|
|
|
235 |
.collect(Collectors.groupingBy(x1 -> x1.getReceiveTimestamp().toLocalDate()));
|
|
|
236 |
|
|
|
237 |
LOGGER.info("dateWiseProviderCreditsMap -- {}", dateWiseProviderCreditsMap);
|
|
|
238 |
LocalDate endDate = LocalDate.now().plusDays(1);
|
|
|
239 |
float previousDayClosing = 0;
|
|
|
240 |
LocalDate date = LocalDate.of(2018, 4, 6);
|
|
|
241 |
while (date.isBefore(endDate)) {
|
|
|
242 |
List<RechargeTransaction> dateWiseRechargeTransactions = rechargeTransactionRepository
|
|
|
243 |
.selectAllBetweenTimestamp(Arrays.asList(RechargeStatus.values()), date.atStartOfDay(),
|
|
|
244 |
date.plusDays(1).atStartOfDay());
|
|
|
245 |
|
|
|
246 |
List<RechargeTransaction> successfulTransactions = dateWiseRechargeTransactions.stream()
|
|
|
247 |
.filter(y -> y.getStatus().equals(RechargeStatus.SUCCESS)).collect(Collectors.toList());
|
|
|
248 |
|
|
|
249 |
float dailyAmount = 0;
|
|
|
250 |
float totalCommission = 0;
|
|
|
251 |
for (RechargeTransaction rechargeTransaction : successfulTransactions) {
|
|
|
252 |
if (rechargeTransaction.getProviderId() == x.getId()) {
|
|
|
253 |
dailyAmount += rechargeTransaction.getAmount();
|
|
|
254 |
totalCommission += rechargeTransaction.getCommission();
|
|
|
255 |
}
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
List<RechargeProviderCreditWalletHistory> rechargeHistoryList = dateWiseProviderCreditsMap.get(date);
|
|
|
259 |
float dailyWalletRecharge = 0;
|
|
|
260 |
if (rechargeHistoryList != null) {
|
|
|
261 |
for (RechargeProviderCreditWalletHistory rechargeProviderCreditWalletHistory : rechargeHistoryList) {
|
|
|
262 |
if (rechargeProviderCreditWalletHistory.getProviderId() == x.getId()) {
|
|
|
263 |
dailyWalletRecharge += rechargeProviderCreditWalletHistory.getAmount();
|
|
|
264 |
}
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
if (dailyAmount > 0 || dailyWalletRecharge > 0) {
|
|
|
268 |
DailyRecharge dailyRecharge = null;
|
|
|
269 |
try {
|
|
|
270 |
dailyRecharge = dailyRechargeRepository.selectByProviderIdAndCreateDate(x.getId(), date);
|
|
|
271 |
} catch (Exception e) {
|
|
|
272 |
LOGGER.info("Could not find Recharge entry");
|
|
|
273 |
}
|
|
|
274 |
if (dailyRecharge == null) {
|
|
|
275 |
dailyRecharge = new DailyRecharge();
|
|
|
276 |
dailyRecharge.setCreateDate(date);
|
|
|
277 |
}
|
|
|
278 |
dailyRecharge.setOpeningBalance(previousDayClosing);
|
|
|
279 |
dailyRecharge.setProviderId(x.getId());
|
|
|
280 |
dailyRecharge.setWalletRechargeAmount(dailyWalletRecharge);
|
|
|
281 |
dailyRecharge.setTotalAmount(dailyAmount);
|
|
|
282 |
dailyRecharge.setTotalCommission(totalCommission);
|
|
|
283 |
float closingBalance = dailyRecharge.getOpeningBalance() + dailyWalletRecharge - dailyAmount;
|
|
|
284 |
dailyRecharge.setClosingBalance(closingBalance);
|
|
|
285 |
dailyRechargeRepository.persist(dailyRecharge);
|
|
|
286 |
x.setAmount(x.getAmount() + dailyRecharge.getClosingBalance() - dailyRecharge.getOpeningBalance());
|
|
|
287 |
previousDayClosing = dailyRecharge.getClosingBalance();
|
|
|
288 |
}
|
|
|
289 |
date = date.plusDays(1);
|
|
|
290 |
}
|
|
|
291 |
rechargeProviderRepository.persist(x);
|
|
|
292 |
});
|
| 23761 |
amit.gupta |
293 |
LOGGER.info("finished generating daily recharge");
|
| 23724 |
amit.gupta |
294 |
}
|
|
|
295 |
|
| 23738 |
amit.gupta |
296 |
public void reconcileRecharge() throws Exception {
|
| 23724 |
amit.gupta |
297 |
LocalDateTime fromDate = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(30);
|
|
|
298 |
LocalDateTime toDate = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS);
|
|
|
299 |
List<RechargeStatus> nonSuccessRechargeStatuses = new ArrayList<>(Arrays.asList(RechargeStatus.values()));
|
|
|
300 |
LOGGER.info("nonSuccessRechargeStatuses {} ", nonSuccessRechargeStatuses);
|
|
|
301 |
nonSuccessRechargeStatuses.remove(RechargeStatus.SUCCESS);
|
|
|
302 |
nonSuccessRechargeStatuses.remove(RechargeStatus.FAILED);
|
|
|
303 |
RechargeCredential thinkWalnutDigitalRechargeEnquiryCredential = new RechargeCredential();
|
|
|
304 |
thinkWalnutDigitalRechargeEnquiryCredential.setRechargeUrl(thinkWalnutDigitalRechargeEnquiryUrl);
|
|
|
305 |
thinkWalnutDigitalRechargeEnquiryCredential.setRechargeUserName(thinkWalnutDigitalRechargeUserName);
|
|
|
306 |
thinkWalnutDigitalRechargeEnquiryCredential.setRechargePassword(thinkWalnutDigitalRechargePassword);
|
|
|
307 |
thinkWalnutDigitalRechargeEnquiryCredential.setRechargeAuthKey(thinkWalnutDigitalRechargeAuthKey);
|
|
|
308 |
Map<String, RechargeStatus> requestRechargeStatusChanged = new HashMap<>();
|
|
|
309 |
List<RechargeTransaction> rechargeTransactions = rechargeTransactionRepository
|
|
|
310 |
.selectAllBetweenTimestamp(nonSuccessRechargeStatuses, fromDate, toDate);
|
|
|
311 |
for (RechargeTransaction rechargeTransaction : rechargeTransactions) {
|
|
|
312 |
try {
|
|
|
313 |
int providerId = rechargeTransaction.getProviderId();
|
|
|
314 |
if (providerId == 1) {
|
|
|
315 |
oxigenRechargeProviderService.doCheckStatusRequest(oxigenRechargeEnquiryUrl, oxigenRechargeAuthKey,
|
|
|
316 |
rechargeTransaction);
|
|
|
317 |
} else if (providerId == 2) {
|
|
|
318 |
thinkWalnutDigitalRechargeProviderService
|
|
|
319 |
.doCheckStatusRequest(thinkWalnutDigitalRechargeEnquiryCredential, rechargeTransaction);
|
|
|
320 |
}
|
|
|
321 |
if (rechargeTransaction.getStatus().equals(RechargeStatus.SUCCESS)
|
|
|
322 |
|| rechargeTransaction.getStatus().equals(RechargeStatus.FAILED)) {
|
|
|
323 |
requestRechargeStatusChanged.put(rechargeTransaction.getRequestId(),
|
|
|
324 |
rechargeTransaction.getStatus());
|
|
|
325 |
}
|
|
|
326 |
} catch (Exception e) {
|
|
|
327 |
LOGGER.info("Could not check status for Request {}", rechargeTransaction.getRequestId());
|
|
|
328 |
}
|
|
|
329 |
}
|
| 23738 |
amit.gupta |
330 |
LOGGER.info("Reconcile recharge ran successfully");
|
| 23724 |
amit.gupta |
331 |
}
|
| 24240 |
amit.gupta |
332 |
|
|
|
333 |
// TemporaryMethod
|
| 24237 |
amit.gupta |
334 |
public void migrateInvoice() {
|
|
|
335 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectFromSaleDate(LocalDateTime.now().minusDays(3));
|
|
|
336 |
Map<Integer, List<FofoOrder>> partnerOrdersMap = new HashMap<>();
|
| 24241 |
amit.gupta |
337 |
partnerOrdersMap = fofoOrders.stream()
|
|
|
338 |
.collect(Collectors.groupingBy(FofoOrder::getFofoId, Collectors.toList()));
|
| 24237 |
amit.gupta |
339 |
for (List<FofoOrder> orderList : partnerOrdersMap.values()) {
|
| 24240 |
amit.gupta |
340 |
int sequence = 0;
|
|
|
341 |
String prefix = "";
|
| 24241 |
amit.gupta |
342 |
List<FofoOrder> sortedList = orderList.stream().sorted((x1, x2) -> x1.getId() - x2.getId())
|
|
|
343 |
.collect(Collectors.toList());
|
|
|
344 |
for (FofoOrder order : sortedList) {
|
|
|
345 |
|
| 24240 |
amit.gupta |
346 |
LOGGER.info("Order Id is {}, partner Id is {}", order.getId(), order.getFofoId());
|
| 24241 |
amit.gupta |
347 |
if (!order.getInvoiceNumber().contains("SEC")) {
|
| 24240 |
amit.gupta |
348 |
sequence = Integer.parseInt(order.getInvoiceNumber().split("/")[1]);
|
|
|
349 |
prefix = order.getInvoiceNumber().split("/")[0];
|
|
|
350 |
} else {
|
|
|
351 |
sequence += 1;
|
| 24241 |
amit.gupta |
352 |
String invoiceNumber = prefix + "/" + sequence;
|
| 24240 |
amit.gupta |
353 |
order.setInvoiceNumber(invoiceNumber);
|
|
|
354 |
fofoOrderRepository.persist(order);
|
|
|
355 |
}
|
|
|
356 |
}
|
| 24241 |
amit.gupta |
357 |
|
| 24237 |
amit.gupta |
358 |
}
|
|
|
359 |
}
|
| 23724 |
amit.gupta |
360 |
|
| 24241 |
amit.gupta |
361 |
// Temporary Method
|
| 24252 |
amit.gupta |
362 |
public void evaluateExcessSchemeOut() throws Exception {
|
| 24244 |
amit.gupta |
363 |
Map<Integer, String> userNameMap = retailerService.getAllFofoRetailerIdNameMap();
|
|
|
364 |
Map<Integer, Float> userAmountMap = new HashMap<>();
|
| 24252 |
amit.gupta |
365 |
|
|
|
366 |
List<List<Object>> rows = new ArrayList<>();
|
| 24271 |
amit.gupta |
367 |
List<String> headers = Arrays.asList("Scheme", "Item", "Partner", "Amount", "Credited On", "Invoice Number",
|
|
|
368 |
"Sale On", "Scheme Start", "Scheme End", "Active On", "Expired On");
|
| 24241 |
amit.gupta |
369 |
schemeRepository.selectAll().stream().forEach(x -> {
|
| 24250 |
amit.gupta |
370 |
if (x.getType().equals(SchemeType.OUT)) {
|
|
|
371 |
List<SchemeInOut> sioList = schemeInOutRepository
|
|
|
372 |
.selectBySchemeIds(new HashSet<>(Arrays.asList(x.getId())));
|
|
|
373 |
if (x.getActiveTimestamp() != null) {
|
|
|
374 |
LocalDateTime endDateTime = x.getEndDateTime();
|
|
|
375 |
if (x.getExpireTimestamp() != null && x.getExpireTimestamp().isBefore(x.getEndDateTime())) {
|
|
|
376 |
endDateTime = x.getExpireTimestamp();
|
| 24249 |
amit.gupta |
377 |
}
|
| 24250 |
amit.gupta |
378 |
for (SchemeInOut sio : sioList) {
|
|
|
379 |
InventoryItem inventoryItem = null;
|
| 24266 |
amit.gupta |
380 |
inventoryItem = inventoryItemRepository.selectById(sio.getInventoryItemId());
|
| 24271 |
amit.gupta |
381 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndSerialNumber(
|
|
|
382 |
inventoryItem.getFofoId(), inventoryItem.getSerialNumber(), null, null, 0, 1).get(0);
|
| 24250 |
amit.gupta |
383 |
Optional<ScanRecord> record = scanRecordRepository
|
|
|
384 |
.selectByInventoryItemId(sio.getInventoryItemId()).stream()
|
|
|
385 |
.filter(y -> y.getType().equals(ScanType.SALE)).findFirst();
|
|
|
386 |
if (record.isPresent()) {
|
|
|
387 |
int fofoId = record.get().getFofoId();
|
|
|
388 |
if (record.get().getCreateTimestamp().isAfter(endDateTime)
|
|
|
389 |
|| record.get().getCreateTimestamp().isBefore(x.getStartDateTime())) {
|
|
|
390 |
if (!userAmountMap.containsKey(fofoId)) {
|
|
|
391 |
userAmountMap.put(fofoId, 0f);
|
|
|
392 |
}
|
|
|
393 |
userAmountMap.put(fofoId, sio.getAmount() + userAmountMap.get(fofoId));
|
|
|
394 |
try {
|
| 24252 |
amit.gupta |
395 |
rows.add(Arrays.asList(x.getDescription(),
|
| 24250 |
amit.gupta |
396 |
itemRepository.selectById(inventoryItem.getItemId()).getItemDescription(),
|
| 24252 |
amit.gupta |
397 |
userNameMap.get(fofoId), sio.getAmount(),
|
| 24253 |
amit.gupta |
398 |
FormattingUtils.formatDate(sio.getCreateTimestamp()),
|
|
|
399 |
fofoOrder.getInvoiceNumber(),
|
|
|
400 |
FormattingUtils.formatDate(record.get().getCreateTimestamp()),
|
|
|
401 |
FormattingUtils.formatDate(x.getStartDateTime()),
|
|
|
402 |
FormattingUtils.formatDate(x.getEndDateTime()),
|
|
|
403 |
FormattingUtils.formatDate(x.getActiveTimestamp()),
|
|
|
404 |
FormattingUtils.formatDate(x.getExpireTimestamp())));
|
| 24250 |
amit.gupta |
405 |
} catch (Exception e) {
|
|
|
406 |
e.printStackTrace();
|
|
|
407 |
}
|
| 24242 |
amit.gupta |
408 |
}
|
| 24241 |
amit.gupta |
409 |
}
|
|
|
410 |
}
|
|
|
411 |
}
|
|
|
412 |
}
|
|
|
413 |
});
|
| 24246 |
amit.gupta |
414 |
userAmountMap.entrySet().stream()
|
|
|
415 |
.forEach(x -> LOGGER.info("{} to be deducted from {}({}) for wrongly disbursed due to technical error.",
|
|
|
416 |
x.getValue(), userNameMap.get(x.getKey())));
|
| 24241 |
amit.gupta |
417 |
|
| 24252 |
amit.gupta |
418 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 24271 |
amit.gupta |
419 |
Utils.sendMailWithAttachment(googleMailSender,
|
|
|
420 |
new String[] { "amit.gupta@shop2020.in", "adeel.yazdani@smartdukaan.com" }, null,
|
|
|
421 |
"Partner Excess Amount", "PFA", "ListofSchemes.csv", new ByteArrayResource(baos.toByteArray()));
|
| 24252 |
amit.gupta |
422 |
|
| 24241 |
amit.gupta |
423 |
}
|
| 24271 |
amit.gupta |
424 |
|
| 24256 |
amit.gupta |
425 |
public void processScheme(int offset) throws Exception {
|
| 24271 |
amit.gupta |
426 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(30 * offset);
|
| 24259 |
amit.gupta |
427 |
LocalDateTime endDate = startDate.plusDays(30);
|
| 24258 |
amit.gupta |
428 |
processScheme(startDate, endDate);
|
| 24256 |
amit.gupta |
429 |
}
|
| 24461 |
amit.gupta |
430 |
|
|
|
431 |
public void processScheme(int offset, int durationDays) throws Exception {
|
|
|
432 |
LocalDateTime startDate = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT).minusDays(30 * offset);
|
|
|
433 |
LocalDateTime endDate = startDate.plusDays(durationDays);
|
|
|
434 |
processScheme(startDate, endDate);
|
|
|
435 |
}
|
| 24271 |
amit.gupta |
436 |
|
| 23738 |
amit.gupta |
437 |
public void processScheme() throws Exception {
|
| 24256 |
amit.gupta |
438 |
LocalDateTime fromDate = LocalDateTime.now().minusDays(30);
|
|
|
439 |
processScheme(fromDate, LocalDateTime.now());
|
|
|
440 |
}
|
| 24271 |
amit.gupta |
441 |
|
| 24256 |
amit.gupta |
442 |
public void processScheme(LocalDateTime startDate, LocalDateTime endDate) throws Exception {
|
| 23724 |
amit.gupta |
443 |
LOGGER.info("Started execution at {}", LocalDateTime.now());
|
| 24256 |
amit.gupta |
444 |
List<Purchase> purchases = purchaseRepository.selectAllBetweenPurchaseDate(startDate, endDate);
|
| 23724 |
amit.gupta |
445 |
for (Purchase purchase : purchases) {
|
|
|
446 |
try {
|
|
|
447 |
schemeService.processSchemeIn(purchase.getId(), purchase.getFofoId());
|
|
|
448 |
} catch (Exception e) {
|
|
|
449 |
LOGGER.error("Error while processing purchase {} for scheme In ", purchase.getId());
|
|
|
450 |
e.printStackTrace();
|
| 24271 |
amit.gupta |
451 |
|
| 23724 |
amit.gupta |
452 |
}
|
|
|
453 |
}
|
| 24256 |
amit.gupta |
454 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectBetweenSaleDate(startDate, endDate);
|
| 23724 |
amit.gupta |
455 |
for (FofoOrder fofoOrder : fofoOrders) {
|
|
|
456 |
try {
|
|
|
457 |
schemeService.processSchemeOut(fofoOrder.getId(), fofoOrder.getFofoId());
|
|
|
458 |
} catch (Exception e) {
|
|
|
459 |
LOGGER.error("Error while processing sale order {} for scheme Out", fofoOrder.getId());
|
|
|
460 |
}
|
|
|
461 |
}
|
|
|
462 |
LOGGER.info("Schemes process successfully.");
|
|
|
463 |
}
|
| 23929 |
amit.gupta |
464 |
|
| 23739 |
amit.gupta |
465 |
public void processRechargeCashback() throws Throwable {
|
| 23761 |
amit.gupta |
466 |
LocalDateTime cashbackTime = LocalDateTime.now();
|
| 23929 |
amit.gupta |
467 |
int referenceId = (int) Timestamp.valueOf(cashbackTime).getTime() / 1000;
|
|
|
468 |
List<RechargeTransaction> pendingTransactions = rechargeTransactionRepository
|
|
|
469 |
.getPendingCashBackRehargeTransactions();
|
|
|
470 |
Map<Object, Double> totalRetailerCashbacks = pendingTransactions.stream().collect(
|
|
|
471 |
Collectors.groupingBy(x -> x.getRetailerId(), Collectors.summingDouble(x -> x.getCommission())));
|
|
|
472 |
for (Map.Entry<Object, Double> totalRetailerCashback : totalRetailerCashbacks.entrySet()) {
|
|
|
473 |
int retailerId = (Integer) totalRetailerCashback.getKey();
|
| 23739 |
amit.gupta |
474 |
float amount = totalRetailerCashback.getValue().floatValue();
|
| 23929 |
amit.gupta |
475 |
if (Math.round(amount) > 0) {
|
|
|
476 |
walletService.addAmountToWallet(retailerId, referenceId, WalletReferenceType.CASHBACK,
|
|
|
477 |
"Recharge Cashback", Math.round(amount));
|
| 23762 |
amit.gupta |
478 |
}
|
| 23739 |
amit.gupta |
479 |
}
|
| 23929 |
amit.gupta |
480 |
for (RechargeTransaction rt : pendingTransactions) {
|
| 23761 |
amit.gupta |
481 |
rt.setCashbackTimestamp(cashbackTime);
|
|
|
482 |
rt.setCashbackReference(referenceId);
|
|
|
483 |
rechargeTransactionRepository.persist(rt);
|
|
|
484 |
}
|
| 23739 |
amit.gupta |
485 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
|
|
486 |
}
|
| 23724 |
amit.gupta |
487 |
|
| 24271 |
amit.gupta |
488 |
public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
|
| 24277 |
amit.gupta |
489 |
LocalDate yesterDay = LocalDate.now().minusDays(1);
|
| 23929 |
amit.gupta |
490 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
|
|
|
491 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
|
|
492 |
.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
|
|
493 |
|
| 24271 |
amit.gupta |
494 |
List<String> headers = Arrays.asList("Code", "StoreName", "Email", "Mobile", "Wallet Amount",
|
|
|
495 |
"Yesterday's Sale", "In Stock Amount", "Return In Transit Stock", "Unbilled Amount",
|
|
|
496 |
"Grn Pending Amount", "Min Investment", "Investment Amount", "Investment Short");
|
| 24002 |
amit.gupta |
497 |
List<List<Object>> rows = new ArrayList<>();
|
|
|
498 |
for (FofoStore fofoStore : fofoStores) {
|
|
|
499 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
|
|
500 |
if (retailer == null) {
|
|
|
501 |
LOGGER.info("Could not find retailer with retailer Id {}", fofoStore.getId());
|
|
|
502 |
continue;
|
|
|
503 |
}
|
| 24337 |
amit.gupta |
504 |
PartnerDailyInvestment partnerDailyInvestment = partnerInvestmentService
|
|
|
505 |
.getInvestment(fofoStore.getId(), 1);
|
|
|
506 |
partnerDailyInvestment.setDate(yesterDay);
|
|
|
507 |
partnerDailyInvestmentRepository.persist(partnerDailyInvestment);
|
| 24314 |
amit.gupta |
508 |
|
| 24002 |
amit.gupta |
509 |
List<Object> row = Arrays.asList(fofoStore.getCode(), retailer.getBusinessName(), retailer.getEmail(),
|
| 24337 |
amit.gupta |
510 |
retailer.getMobileNumber(), partnerDailyInvestment.getWalletAmount(),
|
|
|
511 |
partnerDailyInvestment.getSalesAmount(), partnerDailyInvestment.getInStockAmount(), 0,
|
| 24415 |
amit.gupta |
512 |
partnerDailyInvestment.getUnbilledAmount(), partnerDailyInvestment.getGrnPendingAmount(),
|
| 24337 |
amit.gupta |
513 |
partnerDailyInvestment.getMinInvestment(), partnerDailyInvestment.getTotalInvestment(), partnerDailyInvestment.getShortInvestment());
|
| 24002 |
amit.gupta |
514 |
rows.add(row);
|
|
|
515 |
|
| 23929 |
amit.gupta |
516 |
}
|
| 24271 |
amit.gupta |
517 |
String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| 24002 |
amit.gupta |
518 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 24271 |
amit.gupta |
519 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
|
|
520 |
|
|
|
521 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
|
|
|
522 |
new ByteArrayResource(baos.toByteArray()));
|
|
|
523 |
|
| 23929 |
amit.gupta |
524 |
}
|
| 24177 |
govind |
525 |
|
| 24271 |
amit.gupta |
526 |
public void sendPartnerInvestmentDetails() throws Exception {
|
|
|
527 |
List<String> sendTo = Arrays.asList("adeel.yazdani@smartdukaan.com", "amandeep.singh@smartdukaan.com",
|
|
|
528 |
"tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com", "dhruv.kathpal@smartdukaan.com",
|
|
|
529 |
"neeraj.gupta@smartdukaan.com");
|
|
|
530 |
this.sendPartnerInvestmentDetails(sendTo);
|
|
|
531 |
|
|
|
532 |
}
|
|
|
533 |
|
| 24177 |
govind |
534 |
private void sendMailWithAttachments(String[] email, String[] ccEmails, String body, String subject,
|
| 24187 |
govind |
535 |
Map<String, InputStream> inputStreams)
|
| 24177 |
govind |
536 |
throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 24121 |
govind |
537 |
MimeMessage message = mailSender.createMimeMessage();
|
| 24177 |
govind |
538 |
MimeMessageHelper helper = new MimeMessageHelper(message, true, CharEncoding.UTF_8);
|
|
|
539 |
helper.setSubject(subject);
|
|
|
540 |
helper.setText(body);
|
|
|
541 |
if (ccEmails != null) {
|
|
|
542 |
helper.setCc(ccEmails);
|
|
|
543 |
}
|
| 24240 |
amit.gupta |
544 |
for (String attachment : inputStreams.keySet()) {
|
|
|
545 |
helper.addAttachment(attachment + "_" + LocalDate.now() + ".xls",
|
|
|
546 |
new ByteArrayResource(IOUtils.toByteArray(inputStreams.get(attachment))));
|
| 24187 |
govind |
547 |
}
|
| 24177 |
govind |
548 |
helper.setTo(email);
|
| 24195 |
govind |
549 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smart Dukaan");
|
| 24177 |
govind |
550 |
helper.setFrom(senderAddress);
|
|
|
551 |
mailSender.send(message);
|
| 24135 |
govind |
552 |
}
|
| 24240 |
amit.gupta |
553 |
|
|
|
554 |
private void sendMailWithAttachmentsForPartners(String email, String body, String subject, InputStream is)
|
| 24184 |
govind |
555 |
throws MessagingException, ProfitMandiBusinessException, IOException {
|
|
|
556 |
MimeMessage message = mailSender.createMimeMessage();
|
|
|
557 |
MimeMessageHelper helper = new MimeMessageHelper(message, true, CharEncoding.UTF_8);
|
|
|
558 |
helper.setSubject(subject);
|
|
|
559 |
helper.setText(body);
|
| 24240 |
amit.gupta |
560 |
helper.addAttachment("DailySaleTargetReports_" + LocalDate.now() + ".xls",
|
|
|
561 |
new ByteArrayResource(IOUtils.toByteArray(is)));
|
| 24184 |
govind |
562 |
helper.setTo(email);
|
| 24195 |
govind |
563 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smart Dukaan");
|
| 24184 |
govind |
564 |
helper.setFrom(senderAddress);
|
|
|
565 |
mailSender.send(message);
|
|
|
566 |
}
|
| 24177 |
govind |
567 |
|
|
|
568 |
public void sendMailToSalesHeadAboutTargetAndSales(SaleHeadDetails salesHeadDetail)
|
|
|
569 |
throws MessagingException, ProfitMandiBusinessException, IOException {
|
|
|
570 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
|
|
571 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
|
|
|
572 |
Map<String, InputStream> inputStreams = new HashMap<>();
|
|
|
573 |
for (PartnerTargetDetails partnerTargetDetail : partnerTargetDetails) {
|
|
|
574 |
InputStream is = targetService.getDailySaleReportVsTargetForSaleHead(partnerTargetDetail,
|
|
|
575 |
salesHeadDetail.getName());
|
| 24240 |
amit.gupta |
576 |
|
| 24177 |
govind |
577 |
inputStreams.put(partnerTargetDetail.getTargetName(), is);
|
|
|
578 |
|
| 24174 |
govind |
579 |
}
|
| 24240 |
amit.gupta |
580 |
// String[] ccEmails = null;
|
| 24271 |
amit.gupta |
581 |
if (partnerTargetDetails.size() > 0) {
|
| 24254 |
govind |
582 |
String[] ccEmails = { "Tarun.verma@smartdukaan.com", "Kamini.sharma@smartdukaan.com",
|
|
|
583 |
"chaitnaya.vats@smartdukaan.com", "dhruv.kathpal@smartdukaan.com" };
|
|
|
584 |
String subject = "Daily Sales Report ";
|
|
|
585 |
String message = MessageFormat.format("Sale Target summary for {0}", LocalDate.now());
|
|
|
586 |
LOGGER.info("message" + message);
|
|
|
587 |
if (salesHeadDetail.getName().equals("Kamal")) {
|
|
|
588 |
LOGGER.info("salesHeadDetail.getName()" + salesHeadDetail.getName());
|
|
|
589 |
String[] to = { salesHeadDetail.getEmail(), "mohinder.mutreja@smartdukaan.com" };
|
| 24177 |
govind |
590 |
|
| 24271 |
amit.gupta |
591 |
this.sendMailWithAttachments(to, ccEmails, message, subject, inputStreams);
|
| 24177 |
govind |
592 |
|
| 24271 |
amit.gupta |
593 |
} else {
|
|
|
594 |
LOGGER.info("salesHeadDetail.getName()" + salesHeadDetail.getName());
|
|
|
595 |
String[] to = { salesHeadDetail.getEmail() };
|
|
|
596 |
this.sendMailWithAttachments(to, ccEmails, message, subject, inputStreams);
|
|
|
597 |
}
|
| 24177 |
govind |
598 |
}
|
| 24121 |
govind |
599 |
}
|
| 24177 |
govind |
600 |
|
| 24240 |
amit.gupta |
601 |
public void sendMailToPartnerAboutTargetAndSales() throws ProfitMandiBusinessException, MessagingException,
|
|
|
602 |
IOException, EncryptedDocumentException, InvalidFormatException {
|
| 24177 |
govind |
603 |
List<Integer> fofoIds = targetService.getfofoIdsFromfofoStore();
|
|
|
604 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = retailerService
|
|
|
605 |
.getFofoRetailers(new ArrayList<>(fofoIds));
|
| 24240 |
amit.gupta |
606 |
List<InputStream> input = new ArrayList<>();
|
| 24177 |
govind |
607 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
|
|
608 |
.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
|
|
|
609 |
for (Integer fofoId : fofoIds) {
|
| 24240 |
amit.gupta |
610 |
InputStream is = targetService.getDailySaleReportVsTargetForPartner(fofoId, partnerTargetDetails);
|
|
|
611 |
LOGGER.info("is" + is);
|
|
|
612 |
if (is == null) {
|
| 24192 |
govind |
613 |
continue;
|
|
|
614 |
}
|
| 24240 |
amit.gupta |
615 |
LOGGER.info("fofoId" + fofoId);
|
|
|
616 |
|
| 24177 |
govind |
617 |
LOGGER.info(fofoIdsAndCustomRetailer.get(fofoId).getEmail());
|
| 24240 |
amit.gupta |
618 |
String subject = "Daily Sales Report";
|
|
|
619 |
String message = MessageFormat.format("Sale Target summary for {0}", LocalDate.now());
|
| 24177 |
govind |
620 |
LOGGER.info(message);
|
| 24240 |
amit.gupta |
621 |
this.sendMailWithAttachmentsForPartners(fofoIdsAndCustomRetailer.get(fofoId).getEmail(), message, subject,
|
|
|
622 |
is);
|
|
|
623 |
|
| 24174 |
govind |
624 |
}
|
|
|
625 |
}
|
| 24431 |
amit.gupta |
626 |
|
|
|
627 |
public void moveImeisToPriceDropImeis() throws Exception{
|
|
|
628 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
|
|
629 |
for(PriceDrop priceDrop : priceDrops) {
|
|
|
630 |
priceDropService.priceDropStatus(priceDrop.getId());
|
|
|
631 |
}
|
|
|
632 |
}
|
| 23929 |
amit.gupta |
633 |
|
| 23724 |
amit.gupta |
634 |
}
|