package com.yihu.wlyy.task;

import com.yihu.wlyy.service.third.jw.JwArchivesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

/**
 * 随访记录上传
 * Created by hzp on 2016/12/13.
 */
public class FollowupUploadTask implements Runnable {

    private static Logger logger = LoggerFactory.getLogger(FollowupUploadTask.class);

    @Autowired
    private JwArchivesService jwArchivesService;
    String id = "";

    public FollowupUploadTask(String id) {
        this.id = id;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(3000);
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            jwArchivesService.uploadFollowup(id);
            logger.info("followup:"+id+" upload success.");

        }
        catch (Exception e) {
            e.printStackTrace();
            logger.info("followup:"+id+" upload fail."+e.getMessage());
        }
    }
}
