| Line 12... |
Line 12... |
| 12 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
12 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 13 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
13 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 14 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
14 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 15 |
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
|
15 |
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
|
| 16 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
16 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| - |
|
17 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
| 17 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
18 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
| 18 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
19 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 19 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
20 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 20 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
21 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 21 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
22 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 22 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
23 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 23 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
24 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 24 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
25 |
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
|
| 25 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
26 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 26 |
import com.spice.profitmandi.dao.model.*;
|
- |
|
| 27 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
27 |
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
|
| - |
|
28 |
import com.spice.profitmandi.dao.model.*;
|
| 28 |
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
|
29 |
import com.spice.profitmandi.dao.model.warehouse.LMSGraphRequest;
|
| 29 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
30 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
31 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 31 |
import com.spice.profitmandi.dao.repository.cs.*;
|
32 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 32 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
33 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| Line 1448... |
Line 1449... |
| 1448 |
List<Integer> fofoIds = pp.get(authId);
|
1449 |
List<Integer> fofoIds = pp.get(authId);
|
| 1449 |
fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey())).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
1450 |
fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey())).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
| 1450 |
} else {
|
1451 |
} else {
|
| 1451 |
}
|
1452 |
}
|
| 1452 |
|
1453 |
|
| - |
|
1454 |
// Build escalation map: fofoId -> escalation label (from open tickets)
|
| - |
|
1455 |
Set<Integer> escalationSubCatIds = new HashSet<>(Arrays.asList(
|
| - |
|
1456 |
ProfitMandiConstants.RBM_L2_ESCALATION,
|
| - |
|
1457 |
ProfitMandiConstants.RBM_L3_ESCALATION,
|
| - |
|
1458 |
ProfitMandiConstants.SALES_ESCALATION));
|
| - |
|
1459 |
Map<Integer, String> escalationMap = new HashMap<>();
|
| - |
|
1460 |
List<Integer> partnerFofoIds = new ArrayList<>(fofoIdAndallValues.keySet());
|
| - |
|
1461 |
if (!partnerFofoIds.isEmpty()) {
|
| - |
|
1462 |
List<Ticket> openTickets = ticketRepository.selectAllOpenTickets(partnerFofoIds);
|
| - |
|
1463 |
for (Ticket t : openTickets) {
|
| - |
|
1464 |
if (t.getCloseTimestamp() == null && escalationSubCatIds.contains(t.getSubCategoryId())) {
|
| - |
|
1465 |
String label;
|
| - |
|
1466 |
if (t.getSubCategoryId() == ProfitMandiConstants.RBM_L2_ESCALATION) {
|
| - |
|
1467 |
label = "RBM L2 Escalation";
|
| - |
|
1468 |
} else if (t.getSubCategoryId() == ProfitMandiConstants.RBM_L3_ESCALATION) {
|
| - |
|
1469 |
label = "RBM L3 Escalation";
|
| - |
|
1470 |
} else {
|
| - |
|
1471 |
label = "Sales Escalation";
|
| - |
|
1472 |
}
|
| - |
|
1473 |
// If partner already has an escalation, keep higher priority (Sales > L3 > L2)
|
| - |
|
1474 |
String existing = escalationMap.get(t.getFofoId());
|
| - |
|
1475 |
if (existing == null || label.contains("Sales") || (label.contains("L3") && !existing.contains("Sales"))) {
|
| - |
|
1476 |
escalationMap.put(t.getFofoId(), label);
|
| - |
|
1477 |
}
|
| - |
|
1478 |
}
|
| - |
|
1479 |
}
|
| - |
|
1480 |
}
|
| - |
|
1481 |
model.addAttribute("escalationMap", escalationMap);
|
| - |
|
1482 |
|
| 1453 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
1483 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
| 1454 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
1484 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
| 1455 |
|
1485 |
|
| 1456 |
return "auth_user_partner_detail";
|
1486 |
return "auth_user_partner_detail";
|
| 1457 |
}
|
1487 |
}
|
| Line 1492... |
Line 1522... |
| 1492 |
|
1522 |
|
| 1493 |
LOGGER.info("adminUserChart" + gson.toJson(cm));
|
1523 |
LOGGER.info("adminUserChart" + gson.toJson(cm));
|
| 1494 |
|
1524 |
|
| 1495 |
Map<Integer, MonthlyTarget> monthlyTargetMap = monthlyTargetRepository.selectByDate(YearMonth.now()).stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
1525 |
Map<Integer, MonthlyTarget> monthlyTargetMap = monthlyTargetRepository.selectByDate(YearMonth.now()).stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 1496 |
|
1526 |
|
| - |
|
1527 |
// Build escalation map from open tickets
|
| - |
|
1528 |
Set<Integer> escalationSubCatIds2 = new HashSet<>(Arrays.asList(
|
| - |
|
1529 |
ProfitMandiConstants.RBM_L2_ESCALATION,
|
| - |
|
1530 |
ProfitMandiConstants.RBM_L3_ESCALATION,
|
| - |
|
1531 |
ProfitMandiConstants.SALES_ESCALATION));
|
| - |
|
1532 |
Map<Integer, String> escalationMap = new HashMap<>();
|
| - |
|
1533 |
List<Integer> partnerFofoIds2 = new ArrayList<>(fofoIdAndallValues.keySet());
|
| - |
|
1534 |
if (!partnerFofoIds2.isEmpty()) {
|
| - |
|
1535 |
List<Ticket> openTickets = ticketRepository.selectAllOpenTickets(partnerFofoIds2);
|
| - |
|
1536 |
for (Ticket t : openTickets) {
|
| - |
|
1537 |
if (t.getCloseTimestamp() == null && escalationSubCatIds2.contains(t.getSubCategoryId())) {
|
| - |
|
1538 |
String label;
|
| - |
|
1539 |
if (t.getSubCategoryId() == ProfitMandiConstants.RBM_L2_ESCALATION) {
|
| - |
|
1540 |
label = "RBM L2 Escalation";
|
| - |
|
1541 |
} else if (t.getSubCategoryId() == ProfitMandiConstants.RBM_L3_ESCALATION) {
|
| - |
|
1542 |
label = "RBM L3 Escalation";
|
| - |
|
1543 |
} else {
|
| - |
|
1544 |
label = "Sales Escalation";
|
| - |
|
1545 |
}
|
| - |
|
1546 |
String existing = escalationMap.get(t.getFofoId());
|
| - |
|
1547 |
if (existing == null || label.contains("L3") || (label.contains("Sales") && !existing.contains("L3"))) {
|
| - |
|
1548 |
escalationMap.put(t.getFofoId(), label);
|
| - |
|
1549 |
}
|
| - |
|
1550 |
}
|
| - |
|
1551 |
}
|
| - |
|
1552 |
}
|
| - |
|
1553 |
model.addAttribute("escalationMap", escalationMap);
|
| - |
|
1554 |
|
| 1497 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
1555 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
| 1498 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
1556 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
| 1499 |
model.addAttribute("monthlyTargetMap", monthlyTargetMap);
|
1557 |
model.addAttribute("monthlyTargetMap", monthlyTargetMap);
|
| 1500 |
|
1558 |
|
| 1501 |
List<PartnerType> partnerTypes = Arrays.asList(PartnerType.values()).stream().filter(x -> !x.equals(PartnerType.ALL)).collect(Collectors.toList());
|
1559 |
List<PartnerType> partnerTypes = Arrays.asList(PartnerType.values()).stream().filter(x -> !x.equals(PartnerType.ALL)).collect(Collectors.toList());
|