refactor(配置管理): 重构配置绑定与保存逻辑

将配置绑定逻辑抽象到StringConfig类中,统一处理配置的保存与控件绑定
提取配置键常量到对应服务类中,提高代码可维护性
使用LocalDateTime替代Instant处理时间字段
简化SysConfRepository继承结构,使用自定义基础仓库
优化SysConfWindowController的配置管理逻辑,减少重复代码
This commit is contained in:
2025-08-28 15:55:24 +08:00
parent c793c0925e
commit cf73769ef2
9 changed files with 134 additions and 201 deletions

View File

@@ -1,7 +1,6 @@
package com.ecep.contract.manager.cloud.u8;
import java.time.LocalDateTime;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,8 +9,6 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.manager.Desktop;
import com.ecep.contract.manager.cloud.CloudBaseInfo;
import com.ecep.contract.manager.cloud.CloudInfo;
import com.ecep.contract.manager.ds.company.model.Company;
import com.ecep.contract.manager.ui.AbstManagerWindowController;
import com.ecep.contract.manager.ui.BaseController;

View File

@@ -40,6 +40,11 @@ public class YongYouU8Service implements ViewModelService<CloudYu, CloudYuInfoVi
private static final Logger logger = LoggerFactory.getLogger(YongYouU8Service.class);
public static final String NAME = "用友U8";
public static final String KEY_HOST_IP = "u8.db.server.ip";
public static final String KEY_DATABASE = "u8.db.database";
public static final String KEY_USER_NAME = "u8.db.server.name";
public static final String KEY_PASSWORD = "u8.db.server.password";
@Lazy
@Autowired
private YongYouU8Repository repository;

View File

@@ -1,21 +1,21 @@
package com.ecep.contract.manager.cloud.u8.ctx;
import com.ecep.contract.manager.SpringApp;
import com.ecep.contract.manager.cloud.u8.YongYouU8Service;
import com.ecep.contract.manager.ds.company.model.Company;
import com.ecep.contract.manager.ds.company.model.CompanyOldName;
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
import com.ecep.contract.manager.ds.company.service.CompanyService;
import com.ecep.contract.manager.ds.other.service.SysConfService;
import com.ecep.contract.manager.ui.MessageHolder;
import lombok.Setter;
import org.springframework.util.StringUtils;
import static com.ecep.contract.manager.SpringApp.getBean;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
import static com.ecep.contract.manager.SpringApp.getBean;
import org.springframework.util.StringUtils;
import com.ecep.contract.manager.cloud.u8.YongYouU8Service;
import com.ecep.contract.manager.ds.company.model.Company;
import com.ecep.contract.manager.ds.company.model.CompanyOldName;
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
import com.ecep.contract.manager.ds.company.service.CompanyService;
import com.ecep.contract.manager.ui.MessageHolder;
import lombok.Setter;
public class CompanyCtx extends AbstractYongYouU8Ctx {
/**

View File

@@ -42,13 +42,15 @@ import java.util.stream.Collectors;
@Lazy
@Service
@CacheConfig(cacheNames = "company-customer")
public class CompanyCustomerService extends CompanyBasicService implements ViewModelService<CompanyCustomer, CompanyCustomerViewModel> {
public class CompanyCustomerService extends CompanyBasicService
implements ViewModelService<CompanyCustomer, CompanyCustomerViewModel> {
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerService.class);
private static final String EVALUATION_FORM_NAME1 = "评定表";
public static final String EVALUATION_FORM_NAME2 = "评估表";
public static final String KEY_BASE_PATH = "customer.base.path";
public static final String KEY_SALEBOOK_PATH = "customer.salebook.path";
@Lazy
@Autowired
@@ -78,20 +80,16 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
return companyCustomerRepository.findById(id).orElse(null);
}
@Caching(
evict = {
@Caching(evict = {
@CacheEvict(key = "#p0.id")
}
)
})
public CompanyCustomer save(CompanyCustomer companyCustomer) {
return companyCustomerRepository.save(companyCustomer);
}
@Caching(
evict = {
@Caching(evict = {
@CacheEvict(key = "#p0")
}
)
})
@Override
public void delete(CompanyCustomer entity) {
companyCustomerRepository.delete(entity);
@@ -182,9 +180,9 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
return modified;
}
@Override
protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsDefaultType(F dbFile, File file, Consumer<String> status) {
protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsDefaultType(F dbFile, File file,
Consumer<String> status) {
dbFile.setType((T) CompanyCustomerFileType.General);
fillFile(dbFile, file, null, status);
companyCustomerFileService.save((CompanyCustomerFile) dbFile);
@@ -192,7 +190,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
}
@Override
protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsEvaluationFile(F customerFile, File file, List<File> fileList, Consumer<String> status) {
protected <T, F extends CompanyBasicFile<T>> boolean fillFileAsEvaluationFile(F customerFile, File file,
List<File> fileList, Consumer<String> status) {
boolean modified = super.fillFileAsEvaluationFile(customerFile, file, fileList, status);
if (fileList != null) {
@@ -225,7 +224,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
return modified;
}
private <T, F extends CompanyBasicFile<T>> void updateEvaluationFileByJsonFile(F customerFile, File jsonFile, Consumer<String> status) throws IOException {
private <T, F extends CompanyBasicFile<T>> void updateEvaluationFileByJsonFile(F customerFile, File jsonFile,
Consumer<String> status) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode root = objectMapper.readTree(jsonFile);
if (!root.isObject()) {
@@ -237,7 +237,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
data.remove("valid");
JsonNode type = data.remove("type");
CompanyCustomerEvaluationFormFile formFile = companyCustomerFileService.findCustomerEvaluationFormFileByCustomerFile((CompanyCustomerFile) customerFile);
CompanyCustomerEvaluationFormFile formFile = companyCustomerFileService
.findCustomerEvaluationFormFileByCustomerFile((CompanyCustomerFile) customerFile);
objectMapper.updateValue(formFile, data);
logger.info("load json data from {}", jsonFile.getName());
formFile.setCatalog(type.asText());
@@ -249,7 +250,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
}
@Override
protected <T, F extends CompanyBasicFile<T>> F fillFileType(File file, List<File> fileList, Consumer<String> status) {
protected <T, F extends CompanyBasicFile<T>> F fillFileType(File file, List<File> fileList,
Consumer<String> status) {
CompanyCustomerFile customerFile = new CompanyCustomerFile();
customerFile.setType(CompanyCustomerFileType.General);
if (fillFile(customerFile, file, fileList, status)) {
@@ -271,7 +273,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
protected boolean isEvaluationFile(String fileName) {
return (fileName.contains(EVALUATION_FORM_NAME1)
|| fileName.contains(EVALUATION_FORM_NAME2))
&& (CompanyFileUtils.withExtensions(fileName, CompanyFileUtils.JPG, CompanyFileUtils.JPEG, CompanyFileUtils.PDF));
&& (CompanyFileUtils.withExtensions(fileName, CompanyFileUtils.JPG, CompanyFileUtils.JPEG,
CompanyFileUtils.PDF));
}
public boolean makePathAbsent(CompanyCustomer companyCustomer) {
@@ -302,7 +305,8 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
}
String companyName = company.getName();
String fileName = formatCompanyVendorId(companyCustomer.getId()) + "-" + CompanyFileUtils.escapeFileName(companyName);
String fileName = formatCompanyVendorId(companyCustomer.getId()) + "-"
+ CompanyFileUtils.escapeFileName(companyName);
File dir = new File(basePath, fileName);
if (!dir.exists()) {
@@ -313,7 +317,6 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
return dir;
}
public Page<CompanyCustomer> findAll(Specification<CompanyCustomer> spec, Pageable pageable) {
return companyCustomerRepository.findAll(spec, pageable);
}
@@ -347,6 +350,7 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
/***
* 合并两个CompanyCustomer对象并将fromCustomer的信息合并到toCustomer中并保存到数据库中。
*
* @param from 源客户对象
* @param to 目标客户对象
*/
@@ -359,7 +363,6 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
companyCustomerRepository.delete(from);
}
/**
* 删除 company 的 客户
*/
@@ -386,12 +389,10 @@ public class CompanyCustomerService extends CompanyBasicService implements ViewM
return customerCatalogRepository.findByCode(code).orElse(null);
}
@Caching(
evict = {
@Caching(evict = {
@CacheEvict(key = "'catalog-'+#p0.id"),
@CacheEvict(key = "'catalog-code-'+#p0.code")
}
)
})
public CustomerCatalog save(CustomerCatalog catalog) {
return customerCatalogRepository.save(catalog);
}

View File

@@ -116,6 +116,10 @@ public abstract class AbstractConfigBounder<T> implements ConfigBounder {
T newValue) {
conf.setValue(getConverter().toString(newValue));
conf.setModified(LocalDateTime.now());
save();
}
public void save() {
SysConf saved = getConfService().save(conf);
modified.set(saved.getModified());
created.set(saved.getCreated());

View File

@@ -1,6 +1,8 @@
package com.ecep.contract.manager.ds.other;
import javafx.beans.property.Property;
import javafx.scene.control.Control;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.util.StringConverter;
@@ -10,10 +12,10 @@ public class StringConfig extends AbstractConfigBounder<String> {
super(string);
}
@Override
public TextField getControl() {
return (TextField) super.getControl();
}
// @Override
// public TextField getControl() {
// return (TextField) super.getControl();
// }
@Override
public StringConverter<String> getConverter() {
@@ -37,6 +39,14 @@ public class StringConfig extends AbstractConfigBounder<String> {
@Override
void bindBidirectional(Property<String> property) {
getControl().textProperty().bindBidirectional(property);
Control ctrl = getControl();
if (ctrl == null) {
return;
}
if (ctrl instanceof TextField textField) {
textField.textProperty().bindBidirectional(property);
} else if (ctrl instanceof Label label) {
label.textProperty().bindBidirectional(property);
}
}
}

View File

@@ -1,11 +1,21 @@
package com.ecep.contract.manager.ds.other.controller;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.ecep.contract.manager.cloud.u8.YongYouU8Service;
import com.ecep.contract.manager.ds.contract.service.ContractService;
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
import com.ecep.contract.manager.ds.other.StringConfig;
import com.ecep.contract.manager.ds.vendor.service.CompanyVendorService;
import com.ecep.contract.manager.ds.contract.service.ContractService;
import com.ecep.contract.manager.ds.other.repository.SysConfRepository;
import com.ecep.contract.manager.ui.BaseController;
import jakarta.annotation.PreDestroy;
import javafx.beans.property.SimpleStringProperty;
import javafx.event.ActionEvent;
@@ -14,14 +24,7 @@ import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.io.File;
@Lazy
@Scope("prototype")
@Component
@@ -42,90 +45,76 @@ public class SysConfWindowController extends BaseController {
public Label customerEvaluationFormTemplateLabel;
public Label customerSaleBookPathLabel;
StringConfig contractPathConfig = new StringConfig(ContractService.CONTRACT_BASE_PATH);
StringConfig vendorPathConfig = new StringConfig(CompanyVendorService.KEY_BASE_PATH);
StringConfig vendorEvaluationFormTemplateConfig = new StringConfig(
CompanyVendorService.KEY_EVALUATION_FORM_TEMPLATE);
StringConfig customerPathConfig = new StringConfig(CompanyCustomerService.KEY_BASE_PATH);
StringConfig customerEvaluationFormTemplateConfig = new StringConfig(
CompanyCustomerFileService.KEY_EVALUATION_FORM_TEMPLATE);
StringConfig customerSaleBookPathConfig = new StringConfig(CompanyCustomerService.KEY_SALEBOOK_PATH);
@Autowired
private SysConfRepository confRepository;
private final SimpleStringProperty companyContractPath = new SimpleStringProperty();
private final SimpleStringProperty u8DataBaseServerHost = new SimpleStringProperty();
private final SimpleStringProperty u8DataBaseCatalog = new SimpleStringProperty();
private final SimpleStringProperty u8DataBaseUserName = new SimpleStringProperty();
private final SimpleStringProperty u8DataBasePassword = new SimpleStringProperty();
private final SimpleStringProperty vendorPath = new SimpleStringProperty();
private final SimpleStringProperty vendorEvaluationFormTemplate = new SimpleStringProperty();
private final SimpleStringProperty customerPath = new SimpleStringProperty();
private final SimpleStringProperty customerEvaluationFormTemplate = new SimpleStringProperty();
private final SimpleStringProperty customerSaleBookPath = new SimpleStringProperty();
StringConfig u8DataBaseServerHostConfig = new StringConfig(YongYouU8Service.KEY_HOST_IP);
StringConfig u8DataBaseCatalogConfig = new StringConfig(YongYouU8Service.KEY_DATABASE);
StringConfig u8DataBaseUserNameConfig = new StringConfig(YongYouU8Service.KEY_USER_NAME);
StringConfig u8DataBasePasswordConfig = new StringConfig(YongYouU8Service.KEY_PASSWORD);
public void initialize() {
contractPathConfig.setControl(companyContractPathLabel);
contractPathConfig.initialize();
initializeDirectory(companyContractPathLabel, companyContractPath, ContractService.CONTRACT_BASE_PATH);
vendorPathConfig.setControl(vendorPathLabel);
vendorPathConfig.initialize();
vendorEvaluationFormTemplateConfig.setControl(vendorEvaluationFormTemplateLabel);
vendorEvaluationFormTemplateConfig.initialize();
initializeDirectory(vendorPathLabel, vendorPath, CompanyVendorService.KEY_BASE_PATH);
initializeFile(vendorEvaluationFormTemplateLabel, vendorEvaluationFormTemplate, CompanyVendorService.KEY_EVALUATION_FORM_TEMPLATE);
customerPathConfig.setControl(customerPathLabel);
customerPathConfig.initialize();
customerEvaluationFormTemplateConfig.setControl(customerEvaluationFormTemplateLabel);
customerEvaluationFormTemplateConfig.initialize();
customerSaleBookPathConfig.setControl(customerSaleBookPathLabel);
customerSaleBookPathConfig.initialize();
initializeDirectory(customerPathLabel, customerPath, CompanyCustomerService.KEY_BASE_PATH);
initializeFile(customerEvaluationFormTemplateLabel, customerEvaluationFormTemplate, CompanyCustomerFileService.KEY_EVALUATION_FORM_TEMPLATE);
initializeDirectory(customerSaleBookPathLabel, customerSaleBookPath, "customer.salebook.path");
initializeField(u8DataBaseServerHostField, u8DataBaseServerHost, "u8.db.server.ip");
initializeField(u8DataBaseCatalogField, u8DataBaseCatalog, "u8.db.database");
initializeField(u8DataBaseUserNameField, u8DataBaseUserName, "u8.db.server.name");
initializeField(u8DataBasePasswordField, u8DataBasePassword, "u8.db.server.password");
u8DataBaseServerHostConfig.setControl(u8DataBaseServerHostField);
u8DataBaseServerHostConfig.initialize();
u8DataBaseCatalogConfig.setControl(u8DataBaseCatalogField);
u8DataBaseCatalogConfig.initialize();
u8DataBaseUserNameConfig.setControl(u8DataBaseUserNameField);
u8DataBaseUserNameConfig.initialize();
u8DataBasePasswordConfig.setControl(u8DataBasePasswordField);
u8DataBasePasswordConfig.initialize();
logger.debug("#initialize()");
}
private void initializeFile(Label label, SimpleStringProperty property, String key) {
label.textProperty().bind(property);
property.set(confRepository.get(key, ""));
}
private void initializeDirectory(Label label, SimpleStringProperty property, String key) {
label.textProperty().bind(property);
property.set(confRepository.get(key, ""));
}
private void initializeField(TextField field, SimpleStringProperty property, String key) {
field.textProperty().bindBidirectional(property);
property.set(confRepository.get(key, ""));
property.addListener((observable, oldValue, newValue) -> {
confRepository.set(key, newValue);
});
}
private void directoryChoose(SimpleStringProperty property, String title, String key, ActionEvent event) {
private void directoryChoose(StringConfig config, String title, String key, ActionEvent event) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle(title);
File value = new File(property.get());
File value = new File(config.getProperty().getValue());
chooser.setInitialDirectory(value);
Node node = (Node) event.getSource();
File selected = chooser.showDialog(node.getScene().getWindow());
if (selected != null) {
property.set(selected.getAbsolutePath());
confRepository.set(key, property.get());
config.getProperty().setValue(selected.getAbsolutePath());
config.save();
}
}
public void changeCompanyContractPath(ActionEvent actionEvent) {
directoryChoose(companyContractPath, "请选择合同目录", ContractService.CONTRACT_BASE_PATH, actionEvent);
directoryChoose(contractPathConfig, "请选择合同目录", ContractService.CONTRACT_BASE_PATH, actionEvent);
}
public void changeVendorPath(ActionEvent actionEvent) {
directoryChoose(vendorPath, "请选择供应商目录", CompanyVendorService.KEY_BASE_PATH, actionEvent);
directoryChoose(vendorPathConfig, "请选择供应商目录", CompanyVendorService.KEY_BASE_PATH, actionEvent);
}
public void changeCustomerPath(ActionEvent actionEvent) {
directoryChoose(customerPath, "请选择客户目录", CompanyCustomerService.KEY_BASE_PATH, actionEvent);
directoryChoose(customerPathConfig, "请选择客户目录", CompanyCustomerService.KEY_BASE_PATH, actionEvent);
}
public void changeCustomerSaleBookPath(ActionEvent actionEvent) {
directoryChoose(customerSaleBookPath, "请选择销售台账目录", "customer.salebook.path", actionEvent);
directoryChoose(customerSaleBookPathConfig, "请选择销售台账目录", "customer.salebook.path", actionEvent);
}
// 模拟销毁方法
@@ -134,28 +123,29 @@ public class SysConfWindowController extends BaseController {
}
private void fileChoose(SimpleStringProperty property, String title, String key, ActionEvent event) {
private void fileChoose(StringConfig config, String title, String key, ActionEvent event) {
FileChooser chooser = new FileChooser();
chooser.setTitle(title);
File value = new File(property.get());
File value = new File(config.getProperty().getValue());
chooser.setInitialDirectory(value.getParentFile());
chooser.setInitialFileName(value.getName());
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(" 模板文件(*.xlsx)", "*.xlsx"));
Node node = (Node) event.getSource();
File selected = chooser.showOpenDialog(node.getScene().getWindow());
if (selected != null) {
property.set(selected.getAbsolutePath());
confRepository.set(key, property.get());
config.getProperty().setValue(selected.getAbsolutePath());
config.save();
}
}
public void changeCustomerEvaluationFormTemplate(ActionEvent actionEvent) {
fileChoose(customerEvaluationFormTemplate, "请选择客户资信评估表模板", CompanyCustomerFileService.KEY_EVALUATION_FORM_TEMPLATE, actionEvent);
fileChoose(customerEvaluationFormTemplateConfig, "请选择客户资信评估表模板",
CompanyCustomerFileService.KEY_EVALUATION_FORM_TEMPLATE, actionEvent);
}
public void changeVendorEvaluationFormTemplate(ActionEvent actionEvent) {
fileChoose(vendorEvaluationFormTemplate, "请选择供方调查评价表模板", CompanyVendorService.KEY_EVALUATION_FORM_TEMPLATE, actionEvent);
fileChoose(vendorEvaluationFormTemplateConfig, "请选择供方调查评价表模板",
CompanyVendorService.KEY_EVALUATION_FORM_TEMPLATE,
actionEvent);
}
}

View File

@@ -1,85 +1,11 @@
package com.ecep.contract.manager.ds.other.repository;
import com.ecep.contract.manager.ds.other.model.SysConf;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import java.time.Instant;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import com.ecep.contract.manager.ds.MyRepository;
import com.ecep.contract.manager.ds.other.model.SysConf;
@Repository
public interface SysConfRepository extends CrudRepository<SysConf, String>, PagingAndSortingRepository<SysConf, String> {
default String get(String key) {
return get(key, null);
}
public interface SysConfRepository extends MyRepository<SysConf, String> {
/**
* 读取配置值
*
* @param key 配置项
* @param defaultValue 没有配置时的默认值
* @return 配置值
*/
default String get(String key, String defaultValue) {
Optional<SysConf> optional = findById(key);
if (optional.isPresent()) {
return optional.get().getValue();
} else {
return defaultValue;
}
}
default long get(String key, long defaultValue) {
Optional<SysConf> optional = findById(key);
return optional.map(sysConf -> Long.parseLong(sysConf.getValue())).orElse(defaultValue);
}
default int get(String key, int defaultValue) {
Optional<SysConf> optional = findById(key);
return optional.map(sysConf -> Integer.parseInt(sysConf.getValue())).orElse(defaultValue);
}
default boolean get(String key, boolean defaultValue) {
Optional<SysConf> optional = findById(key);
return optional.map(sysConf -> {
String value = sysConf.getValue();
if (Boolean.parseBoolean(value)) {
return true;
}
return "1".equalsIgnoreCase(value);
}).orElse(defaultValue);
}
/**
* 保存配置值
*
* @param key 配置项
* @param value 配置值
* @return 配置值对象
*/
default SysConf set(String key, String value) {
SysConf conf;
Optional<SysConf> optional = findById(key);
if (optional.isPresent()) {
conf = optional.get();
} else {
conf = new SysConf();
conf.setId(key);
conf.setCreated(Instant.now());
}
conf.setValue(value);
conf.setModified(Instant.now());
save(conf);
return conf;
}
default CompletableFuture<Optional<SysConf>> value(String key) {
return CompletableFuture.supplyAsync(() -> findById(key));
}
default CompletableFuture<SysConf> value(String key, String value) {
return CompletableFuture.supplyAsync(() -> set(key, value));
}
}

View File

@@ -1,6 +1,6 @@
package com.ecep.contract.manager.ds.other.service;
import java.time.Instant;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
@@ -35,10 +35,10 @@ public class SysConfService {
if (conf == null) {
conf = new SysConf();
conf.setId(key);
conf.setCreated(Instant.now());
conf.setCreated(LocalDateTime.now());
}
conf.setValue(value);
conf.setModified(Instant.now());
conf.setModified(LocalDateTime.now());
repository.save(conf);
return conf;
}