WEBBPM-SUPPORT-8471: add method loadData()

This commit is contained in:
Хакимуллин Артём 2024-08-19 17:44:30 +03:00
parent 96bda21c96
commit 41de80f414
4 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,30 @@
package esia.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* @author Artyom Hackimullin
*/
@Service
public class ScheduledLoadDataService {
private static final Logger log = LoggerFactory.getLogger(ScheduledLoadDataService.class);
@Value(value = "${data.load.enable}")
private Boolean isEnableCron;
@Scheduled(cron = "${data.load.cron}")
public void loadData(String code) {
if (isEnableCron) {
log.info("Loading data from database");
//TODO: задание получает справочник и сохраняет его в СУБД. Сделать после добавление таблиц в бд
} else {
log.debug("Data was not loaded");
}
}
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="" relativeToChangelogFile="true"/>
</databaseChangeLog>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="001" author="a.khakimullin" dbms="postgresql">
<comment>create table </comment>
</changeSet>
</databaseChangeLog>

View file

@ -0,0 +1,2 @@
data.load.enable=true
data.load.cron=0 0 */1 * * *