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

import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.scheduler.SysQuartzJob;
import cn.superdesk.uniorder.dto.param.scheduler.SysQuartzJobParam;
import cn.superdesk.uniorder.dubbo.facade.scheduler.DubboSysQuartzJobService;
import cn.superdesk.uniorder.service.scheduler.SysQuartzJobService;
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-12-17 16:35:26
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020-12-17 16:35:26
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboSysQuartzJobServiceImpl implements DubboSysQuartzJobService {

	@Autowired
	private SysQuartzJobService sysQuartzJobService;


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

	@Override
	public void addObj(SysQuartzJobParam param) {

		SysQuartzJob sysQuartzJob = AnBeanUtils.copy(param, SysQuartzJob.class);
		sysQuartzJobService.insertSelective(sysQuartzJob);

	}

	@Override
	public void updateObj(SysQuartzJobParam param) {

		SysQuartzJob sysQuartzJob = AnBeanUtils.copy(param, SysQuartzJob.class);
		sysQuartzJobService.updateByPrimaryKeySelective(sysQuartzJob);
	}

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

	@Override
	public SysQuartzJob findById(Long id) {
		return sysQuartzJobService.findById(id);
	}

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

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

		return sysQuartzJobService.findAll(queryMap);
	}

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


	@Override
	public void addSysQuartzJob(SysQuartzJobParam param) {

		SysQuartzJob sysQuartzJob = AnBeanUtils.copy(param, SysQuartzJob.class);
		sysQuartzJobService.addSysQuartzJob(sysQuartzJob);
	}

	@Override
	public void updateSysQuartzJob(SysQuartzJobParam param) {

		SysQuartzJob sysQuartzJob = AnBeanUtils.copy(param, SysQuartzJob.class);
		sysQuartzJobService.updateSysQuartzJob(sysQuartzJob);
	}

	@Override
	public void updateSysQuartzJob(SysQuartzJob sysQuartzJob) {

		sysQuartzJobService.updateSysQuartzJob(sysQuartzJob);
	}

	@Override
	public void deleteSysQuartzJob(Long id) {
		sysQuartzJobService.deleteSysQuartzJob(id);
	}

	@Override
	public SysQuartzJob findSysQuartzJobById(Long id) {
		return sysQuartzJobService.findSysQuartzJobById(id);
	}

	@Override
	public List<SysQuartzJob> findSysQuartzJobByIsPauseEq0() {
		return sysQuartzJobService.findSysQuartzJobByIsPauseEq0();
	}

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

	}
}
