| Line 55... |
Line 55... |
| 55 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
55 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| 56 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
56 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
57 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
59 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
- |
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrder;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.PrebookingOrder;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.TargetSlab;
|
- |
|
| 69 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
67 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
| 70 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
68 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 71 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
69 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
| 72 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
70 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 73 |
import com.spice.profitmandi.dao.entity.transaction.SellerWarehouse;
|
71 |
import com.spice.profitmandi.dao.entity.transaction.SellerWarehouse;
|
| Line 103... |
Line 101... |
| 103 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
101 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 104 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
102 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
| 105 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
103 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
| 106 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
104 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
105 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.fofo.TargetSlabRepository;
|
- |
|
| 109 |
import com.spice.profitmandi.dao.repository.fofo.TargetSlabRepositoryImpl;
|
- |
|
| 110 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventorySnapshotRepository;
|
106 |
import com.spice.profitmandi.dao.repository.inventory.SaholicInventorySnapshotRepository;
|
| 111 |
import com.spice.profitmandi.dao.repository.inventory.SaholicReservationSnapshotRepository;
|
107 |
import com.spice.profitmandi.dao.repository.inventory.SaholicReservationSnapshotRepository;
|
| 112 |
import com.spice.profitmandi.dao.repository.transaction.LineItemImeisRepository;
|
108 |
import com.spice.profitmandi.dao.repository.transaction.LineItemImeisRepository;
|
| 113 |
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
|
109 |
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
|
| 114 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
110 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| Line 169... |
Line 165... |
| 169 |
|
165 |
|
| 170 |
@Autowired
|
166 |
@Autowired
|
| 171 |
private SaholicReservationSnapshotRepository saholicReservationInventorySnapshotRepository;
|
167 |
private SaholicReservationSnapshotRepository saholicReservationInventorySnapshotRepository;
|
| 172 |
|
168 |
|
| 173 |
@Autowired
|
169 |
@Autowired
|
| 174 |
private TargetSlabRepository targetSlabRepository;
|
- |
|
| 175 |
|
- |
|
| 176 |
@Autowired
|
- |
|
| 177 |
private PartnerTargetRepository partnerTargetRepository;
|
170 |
private PartnerTargetRepository partnerTargetRepository;
|
| 178 |
|
171 |
|
| 179 |
@Autowired
|
172 |
@Autowired
|
| 180 |
private SellerWarehouseRepository sellerWarehouseRepository;
|
173 |
private SellerWarehouseRepository sellerWarehouseRepository;
|
| 181 |
|
174 |
|
| Line 474... |
Line 467... |
| 474 |
}
|
467 |
}
|
| 475 |
|
468 |
|
| 476 |
}
|
469 |
}
|
| 477 |
}
|
470 |
}
|
| 478 |
|
471 |
|
| 479 |
public void createMonthlyTargets() throws Exception {
|
- |
|
| 480 |
Map<String, List<TargetSlab>> defaultSlabs = targetSlabRepository.getAllDefaultSlabs();
|
- |
|
| 481 |
for (String memberType : defaultSlabs.keySet()) {
|
- |
|
| 482 |
PartnerTargetDetails ptd = new PartnerTargetDetails();
|
- |
|
| 483 |
ptd.setBrandName(null);
|
- |
|
| 484 |
|
- |
|
| 485 |
LocalDate startDate = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 486 |
int totalDays = startDate.lengthOfMonth();
|
- |
|
| 487 |
String monthName = startDate.getMonth().toString();
|
- |
|
| 488 |
ptd.setStartDate(startDate.atStartOfDay());
|
- |
|
| 489 |
ptd.setEndDate(startDate.plusDays(totalDays - 1).atTime(LocalTime.MAX));
|
- |
|
| 490 |
ptd.setTargetName(String.format("%s Sales Target for %s Partners", monthName, memberType));
|
- |
|
| 491 |
partnerTargetRepository.persist(ptd);
|
- |
|
| 492 |
TargetSlabRepositoryImpl.TYPE_PARTNER_MAPPING.get(memberType).forEach(x -> {
|
- |
|
| 493 |
x.setTargetId(ptd.getId());
|
- |
|
| 494 |
partnerTargetRepository.persist(x);
|
- |
|
| 495 |
});
|
- |
|
| 496 |
|
- |
|
| 497 |
List<TargetSlab> slabs = defaultSlabs.get(memberType);
|
- |
|
| 498 |
slabs.stream().forEach(x -> {
|
- |
|
| 499 |
x.setTargetId(ptd.getId());
|
- |
|
| 500 |
targetSlabRepository.persist(x);
|
- |
|
| 501 |
});
|
- |
|
| 502 |
}
|
- |
|
| 503 |
}
|
- |
|
| 504 |
|
- |
|
| 505 |
public void populateSchemes() {
|
472 |
public void populateSchemes() {
|
| 506 |
List<Integer> list05 = Arrays.asList(29093, 29094, 29095, 29096, 29097, 29098, 29099, 29101, 29102);
|
473 |
List<Integer> list05 = Arrays.asList(29093, 29094, 29095, 29096, 29097, 29098, 29099, 29101, 29102);
|
| 507 |
List<Integer> list10 = Arrays.asList(29187, 29188);
|
474 |
List<Integer> list10 = Arrays.asList(29187, 29188);
|
| 508 |
List<Integer> list13 = Arrays.asList(28095, 28097, 28098, 28101, 28102, 28104, 28106, 28107, 28108, 28227,
|
475 |
List<Integer> list13 = Arrays.asList(28095, 28097, 28098, 28101, 28102, 28104, 28106, 28107, 28108, 28227,
|
| 509 |
28228, 28229, 28231, 29055, 29056, 29066, 29079);
|
476 |
28228, 28229, 28231, 29055, 29056, 29066, 29079);
|