| Line 1699... |
Line 1699... |
| 1699 |
@RequestParam int authUserId,
|
1699 |
@RequestParam int authUserId,
|
| 1700 |
@RequestParam int categoryId,
|
1700 |
@RequestParam int categoryId,
|
| 1701 |
@RequestParam(required = false) String startLat,
|
1701 |
@RequestParam(required = false) String startLat,
|
| 1702 |
@RequestParam(required = false) String startLng) throws ProfitMandiBusinessException {
|
1702 |
@RequestParam(required = false) String startLng) throws ProfitMandiBusinessException {
|
| 1703 |
|
1703 |
|
| - |
|
1704 |
// Beat planning needs every partner ever assigned — inactive ones included —
|
| - |
|
1705 |
// so the planner can keep building beats around a partner that was paused
|
| - |
|
1706 |
// after the assignment was made. The closed-store skip happens below per row.
|
| 1704 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
1707 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdAllPartnerIdMapping();
|
| 1705 |
List<Integer> fofoIds = pp.get(authUserId);
|
1708 |
List<Integer> fofoIds = pp.get(authUserId);
|
| 1706 |
|
1709 |
|
| 1707 |
if (fofoIds == null || fofoIds.isEmpty()) {
|
1710 |
if (fofoIds == null || fofoIds.isEmpty()) {
|
| 1708 |
Map<String, Object> empty = new HashMap<>();
|
1711 |
Map<String, Object> empty = new HashMap<>();
|
| 1709 |
empty.put("partners", new ArrayList<>());
|
1712 |
empty.put("partners", new ArrayList<>());
|
| Line 1714... |
Line 1717... |
| 1714 |
Map<Integer, CustomRetailer> retailerMap = retailerService.getFofoRetailers(fofoIds);
|
1717 |
Map<Integer, CustomRetailer> retailerMap = retailerService.getFofoRetailers(fofoIds);
|
| 1715 |
|
1718 |
|
| 1716 |
List<Map<String, Object>> partners = new ArrayList<>();
|
1719 |
List<Map<String, Object>> partners = new ArrayList<>();
|
| 1717 |
|
1720 |
|
| 1718 |
for (FofoStore store : fofoStores) {
|
1721 |
for (FofoStore store : fofoStores) {
|
| - |
|
1722 |
// Closed partners are gone for good — skip. Inactive ones are kept
|
| - |
|
1723 |
// so the planner can still drop a beat onto them (the assignment
|
| - |
|
1724 |
// pre-dates the deactivation); the UI tags them visually.
|
| 1719 |
if (!store.isActive() || store.isClosed()) continue;
|
1725 |
if (store.isClosed()) continue;
|
| 1720 |
CustomRetailer retailer = retailerMap.get(store.getId());
|
1726 |
CustomRetailer retailer = retailerMap.get(store.getId());
|
| 1721 |
|
1727 |
|
| 1722 |
Map<String, Object> partnerData = new HashMap<>();
|
1728 |
Map<String, Object> partnerData = new HashMap<>();
|
| 1723 |
partnerData.put("fofoId", store.getId());
|
1729 |
partnerData.put("fofoId", store.getId());
|
| 1724 |
partnerData.put("code", store.getCode());
|
1730 |
partnerData.put("code", store.getCode());
|
| 1725 |
partnerData.put("outletName", store.getOutletName());
|
1731 |
partnerData.put("outletName", store.getOutletName());
|
| - |
|
1732 |
partnerData.put("active", store.isActive());
|
| 1726 |
partnerData.put("type", "partner");
|
1733 |
partnerData.put("type", "partner");
|
| 1727 |
|
1734 |
|
| 1728 |
// Use FofoStore lat/lng directly (migrated from address geocode)
|
1735 |
// Use FofoStore lat/lng directly (migrated from address geocode)
|
| 1729 |
if (store.getLatitude() != null && !store.getLatitude().isEmpty()
|
1736 |
if (store.getLatitude() != null && !store.getLatitude().isEmpty()
|
| 1730 |
&& store.getLongitude() != null && !store.getLongitude().isEmpty()) {
|
1737 |
&& store.getLongitude() != null && !store.getLongitude().isEmpty()) {
|