package cn.superdesk.uniorder.dubbo.consumer.sys.notify;


import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify;
import cn.superdesk.uniorder.dto.param.system.notify.SysNotifyClearByDatabaseRecordCriteria;
import cn.superdesk.uniorder.dto.param.system.notify.SysNotifyParam;
import cn.superdesk.uniorder.dubbo.facade.sys.notify.DubboSysNotifyService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

/**
 * @Description:
 * @Author: linjinyu
 * @Email linjinyu@avic-s.com
 * @CreateDate: 2021-03-01 17:37:17
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021-03-01 17:37:17
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Component
public class SysNotifyDubboConsumerService {

	@Reference(version = "1.0.0", timeout = 10000, retries = -1)
	private DubboSysNotifyService dubboSysNotifyService;


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

	public void addObj(SysNotifyParam param) {

		dubboSysNotifyService.addObj(param);

	}

	public void updateObj(SysNotifyParam param) {

		dubboSysNotifyService.updateObj(param);
	}

	public void deleteObj(Long id) {

		dubboSysNotifyService.deleteObj(id);
	}

	public SysNotify findById(Long id) {

		return dubboSysNotifyService.findById(id);
	}

	public PageInfo<SysNotify> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize) {

		return dubboSysNotifyService.findByPaging(conditions, pageNun, pageSize);
	}

	public List<SysNotify> findAll(Map<String, Object> queryMap) {

		return dubboSysNotifyService.findAll(queryMap);
	}

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


	public void addSysNotify(SysNotifyParam param) {

		dubboSysNotifyService.addSysNotify(param);
	}


	public void updateSysNotify(SysNotifyParam param) {

		dubboSysNotifyService.updateSysNotify(param);
	}


	public void deleteSysNotify(Long id) {
		dubboSysNotifyService.deleteSysNotify(id);
	}


	public SysNotify findSysNotifyById(Long id) {

		return dubboSysNotifyService.findSysNotifyById(id);
	}


	public R<List<SysNotify>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize, String token) {

		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

		return dubboSysNotifyService.pageQuery(conditions, pageNun, pageSize, loginSysUser);
	}

	/****************************************** 计划任务 start ******************************************/

	public void clearByDatabaseRecord(SysNotifyClearByDatabaseRecordCriteria sysNotifyClearByDatabaseRecordCriteria) {

		dubboSysNotifyService.clearByDatabaseRecord(sysNotifyClearByDatabaseRecordCriteria);
	}

	public void clearByFileSystem(SysNotifyClearByDatabaseRecordCriteria sysNotifyClearByDatabaseRecordCriteria) {

		dubboSysNotifyService.clearByFileSystem(sysNotifyClearByDatabaseRecordCriteria);
	}
}
