WEBBPM-SUPPORT-8471: add method loadData()
This commit is contained in:
parent
96bda21c96
commit
41de80f414
4 changed files with 52 additions and 0 deletions
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
2
backend/src/main/resources/load-scheduler.properties
Normal file
2
backend/src/main/resources/load-scheduler.properties
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
data.load.enable=true
|
||||||
|
data.load.cron=0 0 */1 * * *
|
||||||
Loading…
Add table
Add a link
Reference in a new issue