| Line 84... |
Line 84... |
| 84 |
instance.setCloseRemark(remark);
|
84 |
instance.setCloseRemark(remark);
|
| 85 |
agendaInstanceRepository.persist(instance);
|
85 |
agendaInstanceRepository.persist(instance);
|
| 86 |
}
|
86 |
}
|
| 87 |
|
87 |
|
| 88 |
@Override
|
88 |
@Override
|
| - |
|
89 |
public java.util.List<AgendaInstance> filterVisibleForVisit(java.util.List<AgendaInstance> openInstances) {
|
| - |
|
90 |
return filterVisibleForVisitStatic(openInstances);
|
| - |
|
91 |
}
|
| - |
|
92 |
|
| - |
|
93 |
// Static + pure for unit tests. Input must be one store's OPEN instances.
|
| - |
|
94 |
static java.util.List<AgendaInstance> filterVisibleForVisitStatic(java.util.List<AgendaInstance> openInstances) {
|
| - |
|
95 |
if (openInstances == null || openInstances.isEmpty()) return openInstances;
|
| - |
|
96 |
boolean revivalOpen = false;
|
| - |
|
97 |
for (AgendaInstance ai : openInstances) {
|
| - |
|
98 |
if (com.spice.profitmandi.dao.enumuration.dtr.AgendaType.REVIVAL.name().equals(ai.getAgendaType())) {
|
| - |
|
99 |
revivalOpen = true;
|
| - |
|
100 |
break;
|
| - |
|
101 |
}
|
| - |
|
102 |
}
|
| - |
|
103 |
if (!revivalOpen) return openInstances;
|
| - |
|
104 |
java.util.List<AgendaInstance> visible = new java.util.ArrayList<>();
|
| - |
|
105 |
for (AgendaInstance ai : openInstances) {
|
| - |
|
106 |
boolean keep = AgendaSource.MANUAL.name().equals(ai.getSource())
|
| - |
|
107 |
|| com.spice.profitmandi.dao.enumuration.dtr.AgendaType.REVIVAL.name().equals(ai.getAgendaType())
|
| - |
|
108 |
|| com.spice.profitmandi.dao.enumuration.dtr.AgendaType.CREDIT_DUES.name().equals(ai.getAgendaType());
|
| - |
|
109 |
if (keep) visible.add(ai);
|
| - |
|
110 |
}
|
| - |
|
111 |
return visible;
|
| - |
|
112 |
}
|
| - |
|
113 |
|
| - |
|
114 |
@Override
|
| 89 |
public void logVisit(int instanceId, Integer locationTrackingId, int visitorUserId,
|
115 |
public void logVisit(int instanceId, Integer locationTrackingId, int visitorUserId,
|
| 90 |
LocalDate visitDate, String discussion) throws ProfitMandiBusinessException {
|
116 |
LocalDate visitDate, String discussion) throws ProfitMandiBusinessException {
|
| 91 |
AgendaInstance instance = agendaInstanceRepository.selectById(instanceId);
|
117 |
AgendaInstance instance = agendaInstanceRepository.selectById(instanceId);
|
| 92 |
if (instance == null) {
|
118 |
if (instance == null) {
|
| 93 |
throw new ProfitMandiBusinessException("instanceId", instanceId, "Agenda instance not found");
|
119 |
throw new ProfitMandiBusinessException("instanceId", instanceId, "Agenda instance not found");
|