ChmCarryPortService.java 1.37 KB
package com.erry.iclear.dateInterface.service;

import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.ChmCarryPort;
import com.erry.iclear.dateInterface.repository.ChmCarryPortRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Service
@Slf4j
public class ChmCarryPortService {

    @Autowired
    private ChmCarryPortRepository chmCarryPortRepository;

    public List<ChmCarryPort> findAllChmCarryPort(){
        List<ChmCarryPort> result = new ArrayList<>();
        try{
            result=chmCarryPortRepository.findAllChmCarryPort();
        }catch (Exception e){
            log.error("findAllChmCarryPort() error"+e.getMessage());
        }
        return result;
    }

    /**
     * 初始化AppInfo
     */
    public void initChmCarryPort() {
        try {
            List<ChmCarryPort> appInfoList = this.findAllChmCarryPort();
            for (ChmCarryPort chmCarryPort : appInfoList) {

                Constant.chmCarryPortCache.put(chmCarryPort.getPcCode(), chmCarryPort);
            }
        } catch (Exception e) {
            log.error("initAppInfo() error" + e.getMessage());
        }
    }


}