LineVersionsData.java 1.42 KB
package com.bsth.data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.bsth.entity.LineVersions;
import com.bsth.service.LineVersionsService;
import com.bsth.service.StationRouteService;

/**
 * @ClassName: LineVersionsData
 * @Description: TODO(线路版本数据管理)
 */
@Component
@Order(20)
public class LineVersionsData implements CommandLineRunner {

    static Logger logger = LoggerFactory.getLogger(LineVersionsData.class);


    @Autowired
    LineVersionsService lineVersionsService;
    
    @Autowired
    StationRouteService stationRouteService;

    @Override
    public void run(String... arg0) throws Exception {
    	
    	
    	try {
    		List<LineVersions> list = lineVersionsService.lineUpdate();
    		for (LineVersions lineVersions : list) {
        		Integer lineId = lineVersions.getLine().getId();
        		// 更新线路文件
    			Map<String, Object> map = new HashMap<>();
    			map.put("lineId", lineId);
    			stationRouteService.usingSingle(map);
    		}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
}