package cn.superdesk.uniorder.dubbo.provider.operation;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.base.UnifiedOrder;
import cn.superdesk.uniorder.dao.entity.operation.UnifiedOrderIssues;
import cn.superdesk.uniorder.dto.param.operation.UnifiedOrderIssuesParam;
import cn.superdesk.uniorder.dto.param.operation.UnifiedOrderIssuesQueryCriteria;
import cn.superdesk.uniorder.dubbo.facade.operation.DubboUnifiedOrderIssuesService;
import cn.superdesk.uniorder.service.operation.UnifiedOrderIssuesFlowingService;
import cn.superdesk.uniorder.service.operation.UnifiedOrderIssuesService;
import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

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

/**
 * @Description: 问题订单
 * @Author: linjinyu
 * @Email linjinyu@avic-s.com
 * @CreateDate: 2021-01-29 16:47:14
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021-01-29 16:47:14
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboUnifiedOrderIssuesServiceImpl implements DubboUnifiedOrderIssuesService {

	@Autowired
	private UnifiedOrderIssuesService        unifiedOrderIssuesService;
	@Autowired
	private UnifiedOrderIssuesFlowingService unifiedOrderIssuesFlowingService;


	/****************************************** extends BaseService 部分 start ******************************************/

	@Override
	public void addObj(UnifiedOrderIssuesParam param) {

		UnifiedOrderIssues unifiedOrderIssues = AnBeanUtils.copy(param, UnifiedOrderIssues.class);
		unifiedOrderIssuesService.insertSelective(unifiedOrderIssues);

	}

	@Override
	public void updateObj(UnifiedOrderIssuesParam param) {

		UnifiedOrderIssues unifiedOrderIssues = AnBeanUtils.copy(param, UnifiedOrderIssues.class);
		unifiedOrderIssuesService.updateByPrimaryKeySelective(unifiedOrderIssues);
	}

	@Override
	public void deleteObj(Long id) {
		unifiedOrderIssuesService.deleteObj(id);
	}

	@Override
	public UnifiedOrderIssues findById(Long id) {
		return unifiedOrderIssuesService.findById(id);
	}

	@Override
	public PageInfo<UnifiedOrderIssues> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize) {
		return unifiedOrderIssuesService.findByPaging(conditions, pageNun, pageSize);
	}

	@Override
	public List<UnifiedOrderIssues> findAll(Map<String, Object> queryMap) {

		return unifiedOrderIssuesService.findAll(queryMap);
	}

	/****************************************** extends BaseService 部分   end ******************************************/


	@Override
	public void addUnifiedOrderIssues(UnifiedOrderIssuesParam param) {

		UnifiedOrderIssues unifiedOrderIssues = AnBeanUtils.copy(param, UnifiedOrderIssues.class);
		unifiedOrderIssuesService.addUnifiedOrderIssues(unifiedOrderIssues);
	}

	@Override
	public void updateUnifiedOrderIssues(UnifiedOrderIssuesParam param) {

		UnifiedOrderIssues unifiedOrderIssues = AnBeanUtils.copy(param, UnifiedOrderIssues.class);
		unifiedOrderIssuesService.updateUnifiedOrderIssues(unifiedOrderIssues);
	}

	@Override
	public void deleteUnifiedOrderIssues(Long id) {
		unifiedOrderIssuesService.deleteUnifiedOrderIssues(id);
	}

	@Override
	public UnifiedOrderIssues findUnifiedOrderIssuesById(Long id) {
		return unifiedOrderIssuesService.findUnifiedOrderIssuesById(id);
	}

	@Override
	public R<List<UnifiedOrderIssues>> pageQuery(UnifiedOrderIssuesQueryCriteria queryCriteria, int pageNun, int pageSize) {
		return unifiedOrderIssuesService.pageQuery(queryCriteria, pageNun, pageSize);

	}

	@Override
	public List<UnifiedOrder> getToDoUnifiedOrderIssuesList(int pageNun, int pageSize) {
		return unifiedOrderIssuesService.getToDoUnifiedOrderIssuesList(pageNun, pageSize);
	}

	public void runTaskUnifiedOrderIssues(UnifiedOrder entity) {
		unifiedOrderIssuesService.runTaskUnifiedOrderIssues(entity);
	}

	public void touch(String orderSn) {

		unifiedOrderIssuesService.touch(orderSn);
	}

	public void flowing(String sourceJson, String processJson, String orderSn, String uid) {

		unifiedOrderIssuesService.flowingInit(sourceJson, processJson, orderSn, uid);
	}

	/**
	 * 1
	 *
	 * @param sourceJson
	 * @param processJson
	 * @param orderSn
	 * @param uid
	 */
	public void developCall(String sourceJson, String processJson, String orderSn, String uid) {

		unifiedOrderIssuesService.developCall(sourceJson, processJson, orderSn, uid);

	}

	/**
	 * 2
	 *
	 * @param processResult
	 * @param processResult
	 * @param uid
	 */
	public void developCallBack(Integer processResult, String processReport, String uid) {

		unifiedOrderIssuesService.developCallBack(processResult, processReport, uid);
	}
}
