package com.platform.service.thread;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.platform.dao.DataInfoMoveTmpDao;
import com.platform.entities.DataInfoEntityMoveTmp;
import com.platform.service.IMoveDataService;
import com.platform.service.impl.MoveDataServiceImpl;
import com.platform.utils.Constant;

public class TreadMoveData2Start extends Thread{
	
	
	private IMoveDataService dataInfoMove= new MoveDataServiceImpl();
	
	public TreadMoveData2Start() {
		this.setDaemon(true);
	}
	
	@Override
	public void run() {
		boolean isBreak = false;
		while(true){
			if (isBreak) {
				break;
			}
			try {
				List<DataInfoEntityMoveTmp> resultlist = dataInfoMove.findAll();
				for (DataInfoEntityMoveTmp moveEntity : resultlist) {
					if ("1".equals(moveEntity.getCompleteStatus())) {
						moveEntity.setCompleteStatus("3");
						dataInfoMove.update(moveEntity);
					}
				}
				isBreak = true;
				Thread.sleep(Constant.update_dataInfo_sleep_time);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
