package cn.superdesk.uniorder.dubbo.provider.order.base;

import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import cn.superdesk.uniorder.dubbo.facade.order.base.DubboUnifiedOrderCreditService;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.base.UnifiedOrderCredit;
import cn.superdesk.uniorder.dto.dubbo.base.UnifiedOrderCreditParam;
import cn.superdesk.uniorder.service.order.base.UnifiedOrderCreditService;
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-09-23 15:16:04
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020-09-23 15:16:04
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboUnifiedOrderCreditServiceImpl implements DubboUnifiedOrderCreditService {

	@Autowired
	private UnifiedOrderCreditService unifiedOrderCreditService;


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

	@Override
	public void addObj(UnifiedOrderCreditParam param) {

		UnifiedOrderCredit unifiedOrderCredit = AnBeanUtils.copy(param, UnifiedOrderCredit.class);
		unifiedOrderCreditService.insertSelective(unifiedOrderCredit);

	}

	@Override
	public void updateObj(UnifiedOrderCreditParam param) {

		UnifiedOrderCredit unifiedOrderCredit = AnBeanUtils.copy(param, UnifiedOrderCredit.class);
		unifiedOrderCreditService.updateByPrimaryKeySelective(unifiedOrderCredit);
	}

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

	@Override
	public UnifiedOrderCredit findById(Long id) {
		return unifiedOrderCreditService.findById(id);
	}

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

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

		return unifiedOrderCreditService.findAll(queryMap);
	}

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


	@Override
	public void addUnifiedOrderCredit(UnifiedOrderCreditParam param) {

		UnifiedOrderCredit unifiedOrderCredit = AnBeanUtils.copy(param, UnifiedOrderCredit.class);
		unifiedOrderCreditService.addUnifiedOrderCredit(unifiedOrderCredit);
	}

	@Override
	public void updateUnifiedOrderCredit(UnifiedOrderCreditParam param) {

		UnifiedOrderCredit unifiedOrderCredit = AnBeanUtils.copy(param, UnifiedOrderCredit.class);
		unifiedOrderCreditService.updateUnifiedOrderCredit(unifiedOrderCredit);
	}

	@Override
	public void deleteUnifiedOrderCredit(Long id) {
		unifiedOrderCreditService.deleteUnifiedOrderCredit(id);
	}

	@Override
	public UnifiedOrderCredit findUnifiedOrderCreditById(Long id) {
		return unifiedOrderCreditService.findUnifiedOrderCreditById(id);
	}

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

	}

	@Override
	public Map<String, Integer> checkStatement(Map<String, Object> conditions) {
		return unifiedOrderCreditService.checkStatement(conditions);
	}

	/****************************************** 补丁程序 start ******************************************/

	@Override
	public String checkAndFixAccountingStateCustomer(/*积分批次号*/String batchs) {
		return unifiedOrderCreditService.checkAndFixAccountingStateCustomer(batchs);
	}

	/****************************************** 补丁程序   end ******************************************/

	/****************************************** 工具类方法 start ******************************************/

	@Override
	public List<String> queryOrderSnsBySelectCreditIds(List<Long> selectCreditIds) {
		return unifiedOrderCreditService.queryOrderSnsBySelectCreditIds(selectCreditIds);
	}

	/****************************************** 工具类方法   end ******************************************/
}
