package cn.yw.nhyw.nhywjtledydpgl.service;

 import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.yw.nhyw.nhywjtledydpgl.dao.NhywjtledydpglDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("nhywjtledydpglService")
public class NhywjtledydpglService extends BaseService {
	
	private static Log log = LogFactory.getLog(NhywjtledydpglService.class);
	
	@Autowired
	private NhywjtledydpglDao nhywjtledydpglDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Nhywjtledydpgl(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		nhywjtledydpglDao.insert_Nhywjtledydpgl(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Nhywjtledydpgl(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywjtledydpglDao.update_Nhywjtledydpgl(map);
	}
	
	/**
	 * 修改经纬度
	 */
	public Integer updateJtydpJdWdByXh(Map map) throws SQLException{
		CommUtils.addParams(map, true);
		return nhywjtledydpglDao.updateJtydpJdWdByXh(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Nhywjtledydpgl(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return nhywjtledydpglDao.delete_Nhywjtledydpgl(map);
	}
	/**
	 * 修改备注，repairstate
	 */
	public Integer update_NhywjtledydpglRemarks(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywjtledydpglDao.update_NhywjtledydpglRemarks(map);
	}



	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Nhywjtledydpgl(Map map) throws SQLException{
		return nhywjtledydpglDao.batch_delete_Nhywjtledydpgl(map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	/*
	public Integer count_Nhywjtledydpgl(Map map) throws SQLException{
		return nhywjtledydpglDao.count_Nhywjtledydpgl(map);
	}
	*/
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Nhywjtledydpgl(Map map) throws SQLException{
		return nhywjtledydpglDao.query_Nhywjtledydpgl(map);
	}

	/**
	 * 查询全部列表记录
	 */
	public List<Map> query_AllNhywjtledydpgl(Map map) throws SQLException{
		return nhywjtledydpglDao.query_AllNhywjtledydpgl(map);
	}
	
	/**
	 * 查询一条
	 */
	public Map get_Nhywjtledydpgl(Map map) throws SQLException{
		return nhywjtledydpglDao.get_Nhywjtledydpgl(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportNhywjtledydpgl(Map map) throws SQLException{
		return this.listNhywjtledydpglByPage(map);
	}
	*/
	
	/**
	 * Nhywjtledydpgl 分页
	 */
	public Map listNhywjtledydpglByPage(Map map) throws SQLException {
		List<Map> list = nhywjtledydpglDao.query_Nhywjtledydpgl(map);
		Integer totalCount = nhywjtledydpglDao.count_Nhywjtledydpgl(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	/**
	 * 首页诱导屏统计
	 * @return
	 * @throws SQLException
	 */
	public Map statisticsYDPOnlineRate() throws SQLException{
		return  nhywjtledydpglDao.statisticsYDPOnlineRate();
	}
	public Map listNhywjtledydpglStatusByPage(Map map) throws SQLException {
		List<Map> list = nhywjtledydpglDao.query_NhywjtledydpglStatus(map);
		Integer totalCount = nhywjtledydpglDao.count_NhywjtledydpglStatus(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	public Map listNhywjtledydpglStatusByPageUnonline(Map map) throws SQLException {
		List<Map> list = nhywjtledydpglDao.query_NhywjtledydpglStatusUnonline(map);
		Integer totalCount = nhywjtledydpglDao.count_NhywjtledydpglStatusUnonline(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	public Map listYwydphistorystateByPage(Map map) throws SQLException {
		List<Map> list = nhywjtledydpglDao.query_Ywydphistorystate(map);
		Integer totalCount = nhywjtledydpglDao.count_Ywydphistorystate(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map  listYwydpstatusinfoByPage(Map map)throws SQLException{
		List<Map> list = nhywjtledydpglDao.query_Ywydpstatusinfo(map);
		Integer totalCount = nhywjtledydpglDao.count_Ywydpstatusinfo(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map  get_YwNoTaskydpstatusinfo(Map  map)throws SQLException{
		List<Map> list = nhywjtledydpglDao.get_YwNoTaskydpstatusinfo(map);
		Integer totalCount = nhywjtledydpglDao.get_YwNoTaskydpstatusCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	// 更新
	public Integer edit_Ywydpinfo(Map map) throws SQLException{
		return nhywjtledydpglDao.edit_Ywydpinfo(map);
	}

	public Map  listYwAllydpstatusinfo(Map map)throws SQLException{
		List<Map> list = nhywjtledydpglDao.query_YwAllydpstatusinfo(map);
		Integer totalCount = nhywjtledydpglDao.count_YwAllydpstatusinfo(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	/**
	 * 修改当前状态维修 记录
	 */
	public Integer update_NhywledydpCurrentState(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywjtledydpglDao.update_NhywledydpCurrentState(map);
	}

}
