Merge branch 'feature/SUPPORT-9099_add_audit' into develop
This commit is contained in:
commit
b0b31e39aa
10 changed files with 550 additions and 1 deletions
|
|
@ -0,0 +1,42 @@
|
|||
package ru.micord.ervu.account_applications.component.dao;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
import static ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationList.USER_APPLICATION_LIST;
|
||||
import static ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT;
|
||||
|
||||
/**
|
||||
* @author Eduard Tihomirov
|
||||
*/
|
||||
@Repository
|
||||
public class AuditDao {
|
||||
|
||||
private final DSLContext dslContext;
|
||||
|
||||
public AuditDao(DSLContext dslContext) {
|
||||
this.dslContext = dslContext;
|
||||
}
|
||||
|
||||
public void insert(Long listId, String fio, String login, String status, Timestamp timestamp) {
|
||||
dslContext.insertInto(USER_APPLICATION_LIST_AUDIT)
|
||||
.set(USER_APPLICATION_LIST_AUDIT.USER_APPLICATION_LIST_ID, listId)
|
||||
.set(USER_APPLICATION_LIST_AUDIT.FIO, fio)
|
||||
.set(USER_APPLICATION_LIST_AUDIT.STATUS, status)
|
||||
.set(USER_APPLICATION_LIST_AUDIT.DATE, timestamp)
|
||||
.set(USER_APPLICATION_LIST_AUDIT.LOGIN, login)
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<Long> selectAppListIdsByTraceId(String traceId) {
|
||||
return dslContext.select(USER_APPLICATION_LIST.USER_APPLICATION_LIST_ID)
|
||||
.from(USER_APPLICATION_LIST)
|
||||
.where(USER_APPLICATION_LIST.TRACE_ID.eq(traceId))
|
||||
.fetch(USER_APPLICATION_LIST.USER_APPLICATION_LIST_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package ru.micord.ervu.account_applications.component.service;
|
||||
|
||||
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;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.micord.ervu.account_applications.component.dao.AuditDao;
|
||||
import ru.micord.ervu.account_applications.security.context.SecurityContext;
|
||||
import ru.micord.ervu.account_applications.security.model.jwt.UserSession;
|
||||
|
||||
import ru.cg.webbpm.modules.database.api.bean.TableFieldData;
|
||||
import ru.cg.webbpm.modules.database.bean.entity_graph.EntityColumn;
|
||||
|
||||
import static ru.micord.ervu.account_applications.enums.ApplicationStatus.SENT;
|
||||
|
||||
/**
|
||||
* @author Eduard Tihomirov
|
||||
*/
|
||||
@Service
|
||||
public class AuditFormDaoImpl extends FormDaoImpl {
|
||||
|
||||
@Autowired
|
||||
private SecurityContext securityContext;
|
||||
@Autowired
|
||||
private AuditDao auditDao;
|
||||
|
||||
@Override
|
||||
public List<TableFieldData> save(Map<EntityColumn, Object> map) {
|
||||
List<TableFieldData> tableFieldData = super.save(map);
|
||||
UserSession userSession = securityContext.getUserSession();
|
||||
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()));
|
||||
}
|
||||
return tableFieldData;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ import ru.micord.ervu.account_applications.db_beans.public_.tables.Recruitment;
|
|||
import ru.micord.ervu.account_applications.db_beans.public_.tables.Shedlock;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationDocument;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationList;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationListAudit;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationRole;
|
||||
|
||||
|
||||
|
|
@ -97,6 +98,11 @@ public class Public extends SchemaImpl {
|
|||
*/
|
||||
public final UserApplicationList USER_APPLICATION_LIST = UserApplicationList.USER_APPLICATION_LIST;
|
||||
|
||||
/**
|
||||
* The table <code>public.user_application_list_audit</code>.
|
||||
*/
|
||||
public final UserApplicationListAudit USER_APPLICATION_LIST_AUDIT = UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT;
|
||||
|
||||
/**
|
||||
* The table <code>public.user_application_role</code>.
|
||||
*/
|
||||
|
|
@ -139,6 +145,7 @@ public class Public extends SchemaImpl {
|
|||
Shedlock.SHEDLOCK,
|
||||
UserApplicationDocument.USER_APPLICATION_DOCUMENT,
|
||||
UserApplicationList.USER_APPLICATION_LIST,
|
||||
UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT,
|
||||
UserApplicationRole.USER_APPLICATION_ROLE
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import ru.micord.ervu.account_applications.db_beans.public_.tables.Recruitment;
|
|||
import ru.micord.ervu.account_applications.db_beans.public_.tables.Shedlock;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationDocument;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationList;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationListAudit;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationRole;
|
||||
|
||||
|
||||
|
|
@ -81,6 +82,11 @@ public class Tables {
|
|||
*/
|
||||
public static final UserApplicationList USER_APPLICATION_LIST = UserApplicationList.USER_APPLICATION_LIST;
|
||||
|
||||
/**
|
||||
* The table <code>public.user_application_list_audit</code>.
|
||||
*/
|
||||
public static final UserApplicationListAudit USER_APPLICATION_LIST_AUDIT = UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT;
|
||||
|
||||
/**
|
||||
* The table <code>public.user_application_role</code>.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,247 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package ru.micord.ervu.account_applications.db_beans.public_.tables;
|
||||
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Identity;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.PlainSQL;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.SQL;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Select;
|
||||
import org.jooq.Stringly;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.Public;
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.records.UserApplicationListAuditRecord;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class UserApplicationListAudit extends TableImpl<UserApplicationListAuditRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>public.user_application_list_audit</code>
|
||||
*/
|
||||
public static final UserApplicationListAudit USER_APPLICATION_LIST_AUDIT = new UserApplicationListAudit();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<UserApplicationListAuditRecord> getRecordType() {
|
||||
return UserApplicationListAuditRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>public.user_application_list_audit.id</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, UUID> ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("uuid_generate_v4()"), SQLDataType.UUID)), this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>public.user_application_list_audit.user_application_list_id</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, Long> USER_APPLICATION_LIST_ID = createField(DSL.name("user_application_list_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.user_application_list_audit.date</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, Timestamp> DATE = createField(DSL.name("date"), SQLDataType.TIMESTAMP(0).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.user_application_list_audit.status</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, String> STATUS = createField(DSL.name("status"), SQLDataType.VARCHAR(100), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.user_application_list_audit.fio</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, String> FIO = createField(DSL.name("fio"), SQLDataType.VARCHAR(1000), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.user_application_list_audit.login</code>.
|
||||
*/
|
||||
public final TableField<UserApplicationListAuditRecord, String> LOGIN = createField(DSL.name("login"), SQLDataType.VARCHAR(1000), this, "");
|
||||
|
||||
private UserApplicationListAudit(Name alias, Table<UserApplicationListAuditRecord> aliased) {
|
||||
this(alias, aliased, (Field<?>[]) null, null);
|
||||
}
|
||||
|
||||
private UserApplicationListAudit(Name alias, Table<UserApplicationListAuditRecord> aliased, Field<?>[] parameters, Condition where) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.user_application_list_audit</code> table
|
||||
* reference
|
||||
*/
|
||||
public UserApplicationListAudit(String alias) {
|
||||
this(DSL.name(alias), USER_APPLICATION_LIST_AUDIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>public.user_application_list_audit</code> table
|
||||
* reference
|
||||
*/
|
||||
public UserApplicationListAudit(Name alias) {
|
||||
this(alias, USER_APPLICATION_LIST_AUDIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>public.user_application_list_audit</code> table reference
|
||||
*/
|
||||
public UserApplicationListAudit() {
|
||||
this(DSL.name("user_application_list_audit"), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Public.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identity<UserApplicationListAuditRecord, Long> getIdentity() {
|
||||
return (Identity<UserApplicationListAuditRecord, Long>) super.getIdentity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserApplicationListAudit as(String alias) {
|
||||
return new UserApplicationListAudit(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserApplicationListAudit as(Name alias) {
|
||||
return new UserApplicationListAudit(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserApplicationListAudit as(Table<?> alias) {
|
||||
return new UserApplicationListAudit(alias.getQualifiedName(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit rename(String name) {
|
||||
return new UserApplicationListAudit(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit rename(Name name) {
|
||||
return new UserApplicationListAudit(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit rename(Table<?> name) {
|
||||
return new UserApplicationListAudit(name.getQualifiedName(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit where(Condition condition) {
|
||||
return new UserApplicationListAudit(getQualifiedName(), aliased() ? this : null, null, condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit where(Collection<? extends Condition> conditions) {
|
||||
return where(DSL.and(conditions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit where(Condition... conditions) {
|
||||
return where(DSL.and(conditions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit where(Field<Boolean> condition) {
|
||||
return where(DSL.condition(condition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
@PlainSQL
|
||||
public UserApplicationListAudit where(SQL condition) {
|
||||
return where(DSL.condition(condition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
@PlainSQL
|
||||
public UserApplicationListAudit where(@Stringly.SQL String condition) {
|
||||
return where(DSL.condition(condition));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
@PlainSQL
|
||||
public UserApplicationListAudit where(@Stringly.SQL String condition, Object... binds) {
|
||||
return where(DSL.condition(condition, binds));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
@PlainSQL
|
||||
public UserApplicationListAudit where(@Stringly.SQL String condition, QueryPart... parts) {
|
||||
return where(DSL.condition(condition, parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit whereExists(Select<?> select) {
|
||||
return where(DSL.exists(select));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inline derived table from this table
|
||||
*/
|
||||
@Override
|
||||
public UserApplicationListAudit whereNotExists(Select<?> select) {
|
||||
return where(DSL.notExists(select));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package ru.micord.ervu.account_applications.db_beans.public_.tables.records;
|
||||
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jooq.impl.TableRecordImpl;
|
||||
|
||||
import ru.micord.ervu.account_applications.db_beans.public_.tables.UserApplicationListAudit;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class UserApplicationListAuditRecord extends TableRecordImpl<UserApplicationListAuditRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Setter for <code>public.user_application_list_audit.id</code>.
|
||||
*/
|
||||
public void setId(UUID value) {
|
||||
set(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.user_application_list_audit.id</code>.
|
||||
*/
|
||||
public UUID getId() {
|
||||
return (UUID) get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>public.user_application_list_audit.user_application_list_id</code>.
|
||||
*/
|
||||
public void setUserApplicationListId(Long value) {
|
||||
set(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>public.user_application_list_audit.user_application_list_id</code>.
|
||||
*/
|
||||
public Long getUserApplicationListId() {
|
||||
return (Long) get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.user_application_list_audit.date</code>.
|
||||
*/
|
||||
public void setDate(Timestamp value) {
|
||||
set(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.user_application_list_audit.date</code>.
|
||||
*/
|
||||
public Timestamp getDate() {
|
||||
return (Timestamp) get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.user_application_list_audit.status</code>.
|
||||
*/
|
||||
public void setStatus(String value) {
|
||||
set(3, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.user_application_list_audit.status</code>.
|
||||
*/
|
||||
public String getStatus() {
|
||||
return (String) get(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.user_application_list_audit.fio</code>.
|
||||
*/
|
||||
public void setFio(String value) {
|
||||
set(4, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.user_application_list_audit.fio</code>.
|
||||
*/
|
||||
public String getFio() {
|
||||
return (String) get(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.user_application_list_audit.login</code>.
|
||||
*/
|
||||
public void setLogin(String value) {
|
||||
set(5, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.user_application_list_audit.login</code>.
|
||||
*/
|
||||
public String getLogin() {
|
||||
return (String) get(5);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a detached UserApplicationListAuditRecord
|
||||
*/
|
||||
public UserApplicationListAuditRecord() {
|
||||
super(UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached, initialised UserApplicationListAuditRecord
|
||||
*/
|
||||
public UserApplicationListAuditRecord(UUID id, Long userApplicationListId, Timestamp date, String status, String fio, String login) {
|
||||
super(UserApplicationListAudit.USER_APPLICATION_LIST_AUDIT);
|
||||
|
||||
setId(id);
|
||||
setUserApplicationListId(userApplicationListId);
|
||||
setDate(date);
|
||||
setStatus(status);
|
||||
setFio(fio);
|
||||
setLogin(login);
|
||||
resetChangedOnNotNull();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,19 @@
|
|||
package ru.micord.ervu.account_applications.service;
|
||||
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.kafka.common.protocol.types.Field;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.micord.ervu.account_applications.component.dao.AuditDao;
|
||||
import ru.micord.ervu.account_applications.dao.UserApplicationListDao;
|
||||
import ru.micord.ervu.account_applications.security.context.SecurityContext;
|
||||
import ru.micord.ervu.account_applications.security.model.jwt.UserSession;
|
||||
|
||||
import static ru.micord.ervu.account_applications.enums.ApplicationStatus.ACCEPTED;
|
||||
import static ru.micord.ervu.account_applications.enums.ApplicationStatus.AGREED;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
|
|
@ -11,9 +22,13 @@ import ru.micord.ervu.account_applications.dao.UserApplicationListDao;
|
|||
public class UserApplicationListService {
|
||||
|
||||
private final UserApplicationListDao dao;
|
||||
private final AuditDao auditDao;
|
||||
private final SecurityContext securityContext;
|
||||
|
||||
public UserApplicationListService(UserApplicationListDao dao) {
|
||||
public UserApplicationListService(UserApplicationListDao dao, AuditDao auditDao, SecurityContext securityContext) {
|
||||
this.dao = dao;
|
||||
this.auditDao = auditDao;
|
||||
this.securityContext = securityContext;
|
||||
}
|
||||
|
||||
public void saveTraceId(String traceId, long appNumber) {
|
||||
|
|
@ -22,6 +37,7 @@ public class UserApplicationListService {
|
|||
|
||||
public void savePassword(String traceId, String encodedPass) {
|
||||
dao.savePassword(traceId, encodedPass);
|
||||
saveAuditStatusByTraceId(traceId, ACCEPTED.name());
|
||||
}
|
||||
|
||||
public boolean userExists(String login){
|
||||
|
|
@ -30,9 +46,21 @@ public class UserApplicationListService {
|
|||
|
||||
public void saveAcceptedStatus(String traceId) {
|
||||
dao.saveAcceptedStatus(traceId);
|
||||
saveAuditStatusByTraceId(traceId, ACCEPTED.name());
|
||||
}
|
||||
|
||||
public void saveError(String traceId, String errorMsg) {
|
||||
dao.saveError(traceId, errorMsg);
|
||||
saveAuditStatusByTraceId(traceId, AGREED.name());
|
||||
}
|
||||
|
||||
private void saveAuditStatusByTraceId(String traceId, String status) {
|
||||
List<Long> appListIds = auditDao.selectAppListIdsByTraceId(traceId);
|
||||
UserSession userSession = securityContext.getUserSession();
|
||||
String name = userSession.name();
|
||||
String userId = userSession.userId();
|
||||
appListIds.forEach(id -> {
|
||||
auditDao.insert(id, name, userId, status, Timestamp.valueOf(LocalDateTime.now()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
|
||||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
|
||||
|
||||
<changeSet id="0001" author="tihomirov">
|
||||
<comment>add audit table</comment>
|
||||
<sql>
|
||||
CREATE TABLE IF NOT EXISTS public.user_application_list_audit (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
user_application_list_id bigserial,
|
||||
date TIMESTAMP WITHOUT TIME ZONE DEFAULT now(),
|
||||
status character varying(100),
|
||||
fio character varying(1000),
|
||||
login character varying(1000)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE IF EXISTS public.user_application_list_audit
|
||||
OWNER TO ervu_account_applications;
|
||||
|
||||
GRANT ALL ON TABLE public.user_application_role TO ervu_account_applications;
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
@ -20,4 +20,5 @@
|
|||
<include file="20250324-SUPPORT-9023_add_sent_date.xml" relativeToChangelogFile="true"/>
|
||||
<include file="20250404-SUPPORT-9080_add_role_code.xml" relativeToChangelogFile="true"/>
|
||||
<include file="20250410-SUPPORT-9098_admin_role.xml" relativeToChangelogFile="true"/>
|
||||
<include file="20250411_SUPPORT-9099_add_audit.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
|
|
|
|||
|
|
@ -799,6 +799,10 @@
|
|||
<entry>
|
||||
<key>formDao</key>
|
||||
<value>
|
||||
<implRef type="JAVA">
|
||||
<className>AuditFormDaoImpl</className>
|
||||
<packageName>ru.micord.ervu.account_applications.component.service</packageName>
|
||||
</implRef>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>graph</key>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue