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

import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import cn.superdesk.uniorder.dubbo.facade.channel.DubboUnifiedChannelSyncService;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.channel.UnifiedChannelSync;
import cn.superdesk.uniorder.dto.dubbo.channel.UnifiedChannelSyncParam;
import cn.superdesk.uniorder.service.channel.UnifiedChannelSyncService;
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: 2020-08-28 16:37:32
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020-08-28 16:37:32
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboUnifiedChannelSyncServiceImpl implements DubboUnifiedChannelSyncService {

	@Autowired
	private UnifiedChannelSyncService unifiedChannelSyncService;


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

	@Override
	public void addObj(UnifiedChannelSyncParam param) {

		UnifiedChannelSync unifiedChannelSync = AnBeanUtils.copy(param, UnifiedChannelSync.class);
		unifiedChannelSyncService.insertSelective(unifiedChannelSync);

	}

	@Override
	public void updateObj(UnifiedChannelSyncParam param) {

		UnifiedChannelSync unifiedChannelSync = AnBeanUtils.copy(param, UnifiedChannelSync.class);
		unifiedChannelSyncService.updateByPrimaryKeySelective(unifiedChannelSync);
	}

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

	@Override
	public UnifiedChannelSync findById(Long id) {
		return unifiedChannelSyncService.findById(id);
	}

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

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

		return unifiedChannelSyncService.findAll(queryMap);
	}

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


	@Override
	public void addUnifiedChannelSync(UnifiedChannelSyncParam param) {

		UnifiedChannelSync unifiedChannelSync = AnBeanUtils.copy(param, UnifiedChannelSync.class);
		unifiedChannelSyncService.addUnifiedChannelSync(unifiedChannelSync);
	}

	@Override
	public void addUnifiedChannelSync(UnifiedChannelSync channelSync) {
		unifiedChannelSyncService.insertSelective(channelSync);
	}

	@Override
	public void updateUnifiedChannelSync(UnifiedChannelSyncParam param) {

		UnifiedChannelSync unifiedChannelSync = AnBeanUtils.copy(param, UnifiedChannelSync.class);
		unifiedChannelSyncService.updateUnifiedChannelSync(unifiedChannelSync);
	}

	@Override
	public void updateUnifiedChannelSync(UnifiedChannelSync channelSync) {
		unifiedChannelSyncService.updateByPrimaryKeySelective(channelSync);
	}

	@Override
	public void deleteUnifiedChannelSync(Long id) {
		unifiedChannelSyncService.deleteUnifiedChannelSync(id);
	}
//	@Override
//	public void deleteUnifiedChannelSync(Long id) {
//		unifiedChannelSyncService.deleteObj(id);
//	}


	@Override
	public UnifiedChannelSync findUnifiedChannelSyncById(Long id) {
		return unifiedChannelSyncService.findUnifiedChannelSyncById(id);
	}

	@Override
	public R<List<UnifiedChannelSync>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize) {
		return unifiedChannelSyncService.pageQuery(conditions, pageNun, pageSize);

	}


	////////////////////

	@Override
	public List<UnifiedChannelSync> getChannelAll(Map<String, Object> params) {
		return unifiedChannelSyncService.findAll(params);
	}

	@Override
	public UnifiedChannelSync findUnifiedChannelSyncByChannelId(Long id) {
		return unifiedChannelSyncService.findUnifiedChannelSyncByChannelId(id);
	}


	/***************************************************** 关于 UnifiedChannelSync kafka同步 start *****************************************************/
	public void deleteReceiveUnifiedChannelSync(String message) {
		unifiedChannelSyncService.deleteReceiveUnifiedChannelSync(message);
	}

	public void mergeReceiveUnifiedChannelSync(String message) {
		unifiedChannelSyncService.mergeReceiveUnifiedChannelSync(message);
	}
	/***************************************************** 关于 UnifiedChannelSync kafka同步   end *****************************************************/

}
