package com.its.vms.service;

import com.its.vms.config.ApplicationConfig;
import com.its.vms.dao.mapper.VmsFormMapper;
import com.its.vms.dto.TbVmsFormDto;
import com.its.vms.entity.TbVmsAtmp;
import com.its.vms.entity.TbVmsForm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

@Slf4j
@Service
@RequiredArgsConstructor
public class VmsFormService {

    private final ApplicationConfig config;
    private final VmsFormMapper vmsFormMapper;

    public ConcurrentHashMap<Long, TbVmsAtmp> atmpMap = new ConcurrentHashMap<>();

    public void loadFormInfo() {
        loadVmsFormInfo();
    }

    public void loadVmsFormInfo() {
        try {
            List<TbVmsFormDto> infoList  = this.vmsFormMapper.selectVmsFormInfo();
            log.info("VmsFormService.loadVmsFormInfo(), {} EA", infoList.size());
            infoList.forEach(dto -> {
                TbVmsForm obj = dto.toEntity();
            });
        }
        catch (Exception e) {
            log.error("VmsFormService.loadVmsFormInfo: {}", e.toString());
        }
    }

}
