package com.leanwo.activiti.service.base.impl;

import javax.inject.Inject;
import javax.inject.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.leanwo.activiti.dto.ProcessReportResultResponse;
import com.leanwo.activiti.dto.base.TaskDefineDto;
import com.leanwo.activiti.service.base.ProcessReportService;
import com.leanwo.activiti.util.LoginContextUtil;

@Named
public class ProcessReportServiceImpl implements ProcessReportService {
    
    private static Logger logger = LoggerFactory.getLogger(ProcessReportServiceImpl.class);
    
	@Inject
	private ProdogServer prodogServer;

	@Override
	public ProcessReportResultResponse autoRun(TaskDefineDto taskDefineDto) {
	    Long accountId = LoginContextUtil.getLoginContext().getAccountId();
		ProcessReportResultResponse processReportResultResponse = prodogServer.autoRunProcessReport(accountId, taskDefineDto);
		logger.debug("isSuccess:" + processReportResultResponse.getProcessResult().getSuccess()
				+ ",isCanRunReport:" + processReportResultResponse.getProcessResult().getCanRunReport());
		return processReportResultResponse;
	}

}
