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.base.DocumentInfoDto;
import com.leanwo.activiti.dto.base.NodeApprovedRequest;
import com.leanwo.activiti.dto.base.NodeApprovedResponse;
import com.leanwo.activiti.service.base.DocumentOperationService;

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

	@Override
	public void approveDocument(Long accountId, DocumentInfoDto documentInfoDto) {
		prodogServer.approveDocument(documentInfoDto);
		logger.debug("单据设置审批通过。");
	}

	@Override
	public void rejectDocument(Long accountId, DocumentInfoDto documentInfoDto) {
		prodogServer.rejectDocument(documentInfoDto);
		logger.debug("单据设置审批不通过。");
	}

	@Override
	public void withdrawDocument(Long accountId, DocumentInfoDto documentInfoDto) {
		prodogServer.withdrawDocument(documentInfoDto);
		logger.debug("单据设置审批已撤回。");
	}

	@Override
	public NodeApprovedResponse afterNodeApproved(NodeApprovedRequest nodeApprovedRequest) {
		return prodogServer.afterNodeApproved(nodeApprovedRequest);
	}
}
