| Line 10... |
Line 10... |
| 10 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 11 |
import java.util.Set;
|
11 |
import java.util.Set;
|
| 12 |
import java.util.stream.Collectors;
|
12 |
import java.util.stream.Collectors;
|
| 13 |
|
13 |
|
| 14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
14 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
15 |
import com.spice.profitmandi.dao.enumuration.catalog.StockTransactionType;
|
| 15 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
16 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 16 |
import org.apache.logging.log4j.LogManager;
|
17 |
import org.apache.logging.log4j.LogManager;
|
| 17 |
import org.apache.logging.log4j.Logger;
|
18 |
import org.apache.logging.log4j.Logger;
|
| 18 |
import org.springframework.beans.factory.annotation.Autowired;
|
19 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 19 |
import org.springframework.core.io.ByteArrayResource;
|
20 |
import org.springframework.core.io.ByteArrayResource;
|
| Line 145... |
Line 146... |
| 145 |
switch (walletReferenceType) {
|
146 |
switch (walletReferenceType) {
|
| 146 |
case PURCHASE:
|
147 |
case PURCHASE:
|
| 147 |
reconciliation.addAll(reconcileOrdersAndWallet(dateToReconcile, referenceWalletMap, history));
|
148 |
reconciliation.addAll(reconcileOrdersAndWallet(dateToReconcile, referenceWalletMap, history));
|
| 148 |
break;
|
149 |
break;
|
| 149 |
case SCHEME_IN:
|
150 |
case SCHEME_IN:
|
| - |
|
151 |
for (SchemeType schemeType : SchemeType.IN_TYPES) {
|
| 150 |
reconciliation.addAll(reconcileSchemeInAndWallet(dateToReconcile, referenceWalletMap, history,
|
152 |
reconciliation.addAll(reconcileSchemeInAndWallet(dateToReconcile, referenceWalletMap, history,
|
| 151 |
schemeTypeMap.get(SchemeType.IN)));
|
153 |
schemeTypeMap.get(schemeType)));
|
| - |
|
154 |
}
|
| 152 |
break;
|
155 |
break;
|
| 153 |
case SCHEME_OUT:
|
156 |
case SCHEME_OUT:
|
| - |
|
157 |
for (SchemeType schemeType : SchemeType.OUT_TYPES) {
|
| 154 |
reconciliation.addAll(reconcileSchemeOutAndWallet(dateToReconcile, referenceWalletMap, history,
|
158 |
reconciliation.addAll(reconcileSchemeOutAndWallet(dateToReconcile, referenceWalletMap, history,
|
| 155 |
schemeTypeMap.get(SchemeType.OUT)));
|
159 |
schemeTypeMap.get(schemeType)));
|
| 156 |
break;
|
160 |
break;
|
| - |
|
161 |
}
|
| 157 |
default:
|
162 |
default:
|
| 158 |
break;
|
163 |
break;
|
| 159 |
|
164 |
|
| 160 |
}
|
165 |
}
|
| 161 |
}
|
166 |
}
|
| Line 295... |
Line 300... |
| 295 |
"InventoryId\tSerialNumber\tItem Id\tScheme Id\tScheme Name\tScheme Type\tAmount Type\tScheme Amount\tAmount Paid\tReference\tTransaction Time\tScheme Start\tScheme End\tScheme Expiry");
|
300 |
"InventoryId\tSerialNumber\tItem Id\tScheme Id\tScheme Name\tScheme Type\tAmount Type\tScheme Amount\tAmount Paid\tReference\tTransaction Time\tScheme Start\tScheme End\tScheme Expiry");
|
| 296 |
for (Scheme scheme : allSchemes) {
|
301 |
for (Scheme scheme : allSchemes) {
|
| 297 |
if (scheme.getExpireTimestamp() != null) {
|
302 |
if (scheme.getExpireTimestamp() != null) {
|
| 298 |
if (scheme.getExpireTimestamp().isBefore(scheme.getEndDateTime())) {
|
303 |
if (scheme.getExpireTimestamp().isBefore(scheme.getEndDateTime())) {
|
| 299 |
List<SchemeInOut> inOuts = schemeInOutRepository.selectBySchemeIds(Sets.newHashSet(scheme.getId()));
|
304 |
List<SchemeInOut> inOuts = schemeInOutRepository.selectBySchemeIds(Sets.newHashSet(scheme.getId()));
|
| 300 |
if (scheme.getType().equals(SchemeType.IN)) {
|
305 |
if (scheme.getType().getTransactionType().equals(StockTransactionType.IN)) {
|
| 301 |
for (SchemeInOut schemeInOut : inOuts) {
|
306 |
for (SchemeInOut schemeInOut : inOuts) {
|
| 302 |
ScanRecord inRecord = scanRecordRepository
|
307 |
ScanRecord inRecord = scanRecordRepository
|
| 303 |
.selectByInventoryItemId(schemeInOut.getInventoryItemId()).stream()
|
308 |
.selectByInventoryItemId(schemeInOut.getInventoryItemId()).stream()
|
| 304 |
.filter(x -> x.getType().equals(ScanType.PURCHASE)).collect(Collectors.toList())
|
309 |
.filter(x -> x.getType().equals(ScanType.PURCHASE)).collect(Collectors.toList())
|
| 305 |
.get(0);
|
310 |
.get(0);
|
| Line 314... |
Line 319... |
| 314 |
scheme.getEndDateTime(), scheme.getExpireTimestamp()));
|
319 |
scheme.getEndDateTime(), scheme.getExpireTimestamp()));
|
| 315 |
}
|
320 |
}
|
| 316 |
|
321 |
|
| 317 |
}
|
322 |
}
|
| 318 |
}
|
323 |
}
|
| 319 |
if (scheme.getType().equals(SchemeType.OUT)) {
|
324 |
if (scheme.getType().getTransactionType().equals(StockTransactionType.OUT)) {
|
| 320 |
for (SchemeInOut schemeInOut : inOuts) {
|
325 |
for (SchemeInOut schemeInOut : inOuts) {
|
| 321 |
ScanRecord outRecord = scanRecordRepository
|
326 |
ScanRecord outRecord = scanRecordRepository
|
| 322 |
.selectByInventoryItemId(schemeInOut.getInventoryItemId()).stream()
|
327 |
.selectByInventoryItemId(schemeInOut.getInventoryItemId()).stream()
|
| 323 |
.filter(x -> x.getType().equals(ScanType.SALE))
|
328 |
.filter(x -> x.getType().equals(ScanType.SALE))
|
| 324 |
.sorted((x1, x2) -> x1.getId() - x2.getId()).collect(Collectors.toList()).get(0);
|
329 |
.sorted((x1, x2) -> x1.getId() - x2.getId()).collect(Collectors.toList()).get(0);
|