SUPPORT-9099: Fix
This commit is contained in:
parent
461ffd320f
commit
de707ee81e
1 changed files with 12 additions and 14 deletions
|
|
@ -4,6 +4,7 @@ import java.sql.Timestamp;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import dao.container.FormDaoImpl;
|
||||
|
|
@ -31,21 +32,18 @@ public class AuditFormDaoImpl extends FormDaoImpl {
|
|||
|
||||
@Override
|
||||
public List<TableFieldData> save(Map<EntityColumn, Object> map) {
|
||||
List<TableFieldData> tableFieldData = this.saveDao.save(map);
|
||||
List<TableFieldData> tableFieldData = super.save(map);
|
||||
UserSession userSession = securityContext.getUserSession();
|
||||
AtomicReference<String> status = new AtomicReference<>();
|
||||
AtomicReference<Long> appListId = new AtomicReference<>();
|
||||
map.forEach((entityColumn, o) -> {
|
||||
if (entityColumn.getName().equals("application_status")) {
|
||||
status.set(o.toString());
|
||||
}
|
||||
});
|
||||
tableFieldData.forEach(data -> {
|
||||
if (data.getField().getName().equals("user_application_list_id")) {
|
||||
appListId.set((Long) data.getData());
|
||||
}
|
||||
});
|
||||
if (status.get() != null && appListId.get() != null && !status.get().equals(SENT.name())) {
|
||||
Optional<String> status = map.entrySet().stream()
|
||||
.filter(entry -> entry.getKey().getName().equals("application_status"))
|
||||
.map(entry -> entry.getValue().toString())
|
||||
.findAny();
|
||||
|
||||
Optional<Long> appListId = tableFieldData.stream()
|
||||
.filter(data -> data.getField().getName().equals("user_application_list_id"))
|
||||
.map(data -> (Long) data.getData())
|
||||
.findAny();
|
||||
if (status.isPresent() && appListId.isPresent() && !status.get().equals(SENT.name())) {
|
||||
auditDao.insert(appListId.get(), userSession.name(), userSession.userId(), status.get(), Timestamp.valueOf(
|
||||
LocalDateTime.now()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue