| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.migrations;
|
1 |
package com.smartdukaan.cron.migrations;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDate;
|
3 |
import java.time.LocalDate;
|
| 4 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.LocalTime;
|
5 |
import java.time.LocalTime;
|
| 6 |
import java.util.ArrayList;
|
- |
|
| 7 |
import java.util.Arrays;
|
6 |
import java.util.Arrays;
|
| 8 |
import java.util.Collections;
|
7 |
import java.util.Collections;
|
| 9 |
import java.util.HashMap;
|
8 |
import java.util.HashMap;
|
| 10 |
import java.util.HashSet;
|
9 |
import java.util.HashSet;
|
| 11 |
import java.util.List;
|
10 |
import java.util.List;
|
| 12 |
import java.util.Map;
|
11 |
import java.util.Map;
|
| 13 |
import java.util.stream.Collectors;
|
12 |
import java.util.stream.Collectors;
|
| 14 |
|
13 |
|
| 15 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
- |
|
| 16 |
import org.apache.commons.lang.StringUtils;
|
14 |
import org.apache.commons.lang.StringUtils;
|
| 17 |
import org.apache.logging.log4j.LogManager;
|
15 |
import org.apache.logging.log4j.LogManager;
|
| 18 |
import org.apache.logging.log4j.Logger;
|
16 |
import org.apache.logging.log4j.Logger;
|
| 19 |
import org.springframework.beans.factory.annotation.Autowired;
|
17 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 20 |
import org.springframework.core.io.ByteArrayResource;
|
- |
|
| 21 |
import org.springframework.mail.javamail.JavaMailSender;
|
18 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 22 |
import org.springframework.stereotype.Component;
|
19 |
import org.springframework.stereotype.Component;
|
| 23 |
import org.springframework.transaction.annotation.Transactional;
|
20 |
import org.springframework.transaction.annotation.Transactional;
|
| 24 |
|
21 |
|
| 25 |
import com.spice.profitmandi.common.util.FileUtil;
|
- |
|
| 26 |
import com.spice.profitmandi.common.util.Utils;
|
- |
|
| 27 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
22 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 28 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
23 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 29 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
24 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
| 30 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
25 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 31 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
26 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 32 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
27 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
| 33 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
28 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 34 |
import com.spice.profitmandi.dao.entity.transaction.ReturnOrder;
|
- |
|
| 35 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
- |
|
| 36 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
- |
|
| 37 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
29 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 38 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
30 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 40 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 41 |
import com.spice.profitmandi.dao.repository.fofo.DebitNoteRepository;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.DebitNoteRepository;
|
| Line 56... |
Line 48... |
| 56 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
48 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 57 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
49 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 58 |
import com.spice.profitmandi.service.user.RetailerService;
|
50 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 59 |
import com.spice.profitmandi.service.wallet.WalletService;
|
51 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 60 |
|
52 |
|
| 61 |
import in.shop2020.model.v1.order.OrderStatus;
|
- |
|
| 62 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
53 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| 63 |
|
54 |
|
| 64 |
@Component
|
55 |
@Component
|
| 65 |
@Transactional(rollbackFor = Throwable.class)
|
56 |
@Transactional(rollbackFor = Throwable.class)
|
| 66 |
public class RunOnceTasks {
|
57 |
public class RunOnceTasks {
|
| Line 289... |
Line 280... |
| 289 |
}
|
280 |
}
|
| 290 |
}
|
281 |
}
|
| 291 |
// throw new Exception();
|
282 |
// throw new Exception();
|
| 292 |
}
|
283 |
}
|
| 293 |
|
284 |
|
| 294 |
// Lets work it up for The Mobile Planet
|
285 |
public void migrateChallansToInvoices() {
|
| - |
|
286 |
Map<String, List<Order>> invoiceOrdersMap = orderRepository.selectAllChallans().stream().filter(x->x.getLineItem().getHsnCode().equals("NOGST"))
|
| - |
|
287 |
.collect(Collectors.groupingBy(Order::getInvoiceNumber, Collectors.toList()));
|
| - |
|
288 |
|
| - |
|
289 |
for(String invoice : invoiceOrdersMap.keySet()) {
|
| - |
|
290 |
Order oneOrder = invoiceOrdersMap.get(invoice).get(0);
|
| - |
|
291 |
int totalOrders = invoiceOrdersMap.get(invoice).size();
|
| 295 |
// HRFB002 - 157112773
|
292 |
LineItem lineItem = oneOrder.getLineItem();
|
| - |
|
293 |
LOGGER.info("Total Orders {}, Challan No {}, Product Name {} {} {}, hsnCode",
|
| - |
|
294 |
totalOrders, oneOrder.getInvoiceNumber(), lineItem.getBrand(), lineItem.getModelName(), lineItem.getModelName());
|
| - |
|
295 |
}
|
| - |
|
296 |
}
|
| 296 |
|
297 |
|
| 297 |
}
|
298 |
}
|
| 298 |
|
299 |
|