package com.xintong.visualinspection.service.impl;

import java.util.List;

import com.xintong.visualinspection.service.UserService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xintong.visualinspection.bean.CheckAppeal;
import com.xintong.visualinspection.dao.master.CheckAppealDao;
import com.xintong.visualinspection.service.BaseService;
import com.xintong.visualinspection.service.CheckAppealService;
import com.xintong.visualinspection.util.CacheUtil;

/**
 * 文件名：UserServiceImpl
 * 版本信息：日期：2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@Service
public class CheckAppealServiceImpl extends BaseService implements CheckAppealService {

    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CheckAppealServiceImpl.class);


    @Autowired
    private CheckAppealDao checkAppealDao;
    @Autowired
    private UserService userService;

	@Override
	public List<CheckAppeal> getList(CheckAppeal param) {
		List<CheckAppeal> list = checkAppealDao.getList(param);
		return getList(list) ;
	}
	public List<CheckAppeal> getList(List<CheckAppeal> checkAppeallist){
		for (CheckAppeal checkAppeal : checkAppeallist) {
			checkAppeal.setAppeal_man_name(CacheUtil.getUserTurenameFromMap(checkAppeal.getAppeal_man()));
			checkAppeal.setVerify_person_name(CacheUtil.getUserTurenameFromMap(checkAppeal.getVerify_person()));
			checkAppeal.setCheckman_name(CacheUtil.getUserTurenameFromMap(checkAppeal.getCheckman()));
			checkAppeal.setRecheckman_name(CacheUtil.getUserTurenameFromMap(checkAppeal.getRecheckman()));
			checkAppeal.setAppeal_dept_name(CacheUtil.getOrgannameFromMap(checkAppeal.getAppeal_dept()));
		}
		return checkAppeallist;
	}

	@Override
	public CheckAppeal getById(Long id) {
		return checkAppealDao.getOne(id);
	}


	@Override
	public void insert(CheckAppeal checkAppeal) {
		checkAppealDao.insert(checkAppeal);
	}


	@Override
	public void update(CheckAppeal checkAppeal) {
		checkAppealDao.update(checkAppeal);
	}


	@Override
	public void delete(Long id) {
		checkAppealDao.delete(id);
	}
	@Override
	public CheckAppeal getByTaskId(Long id) {
		// TODO Auto-generated method stub
		return checkAppealDao.getByTaskId(id);
	}

}
