package com.palmnest.dao.repair;

import com.palmnest.application.bean.Page;
import com.palmnest.dao.GenericDao;
import com.palmnest.model.repair.RepairBill;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author wangxz
 * <p>
 * 2018年5月2日
 */
public interface RepairBillDao extends GenericDao<RepairBill, Long> {

	public Page findPageByStatus(Integer status, String repairTypeIds, Long serviceUser, int pageSize, int pageNo, Integer orgId);

	public List<RepairBill> findBy(Long userId, Long areaId);

	public Page findPageBy(Map<String, Object> params, int pageSize, int pageNo);

	public List<RepairBill> findSingleOvertime();

	/**
	 * 查找所有挂单预计开始时间超过当前时间的单
	 *
	 * @return
	 */
	public List<RepairBill> findPendOvertime();

	RepairBill findByCode(String code, BigDecimal repairCost);

	/**
	 * 查找所有挂单预计开始时间超过当前时间5分钟的单
	 *
	 * @return
	 */
	List<RepairBill> findManagePendOvertime();

	public Integer findCountBy(Integer status, String repairTypeIds, Long serviceUser, Integer orgId);

	RepairBill findByCode(String code);

	public Integer updateGrabBill(RepairBill bill, Integer version);
	public Integer updateSendUserData(String sendBillIds);

	List<RepairBill> getTotalByRepairTypeId(Long repairTypeId, Date dateFrom, Date dateTo,String orgIds);

    Page findPageByRepairUser(Map<String, Object> params, int pageSize, int pageNo);

    Page findBordPage(Map<String, Object> conditions, int pageSize, int pageNo);

	List<RepairBill> findByOrg(String orgIds);
	
	/**
	 * 获取微信端创建的所有工单数、收费数、费用
	 * @param orgId
	 * @param virtId
	 * @param type
	 * @param date
	 * @param endDate
	 * @return
	 */
	Page getAllWxOrder(Map<String, Object> conditions,int type,int pageNo,int pageSize);
	
	/**
	 * 获取订单明细
	 * @param orgId
	 * @param virtId
	 * @param isFree  ==1获取所有工单数的明细 ==0获取收费工单数的明细
	 * @param type
	 * @param date
	 * @param endDate
	 * @return
	 */
	Page getWxAmountOrder(Map<String, Object> conditions,int isFree,int type,int pageNo,int pageSize);
	
	/**
	 * 获取微信端创建的所有工单数、收费数、费用
	 * @param orgId
	 * @param virtId
	 * @param type
	 * @param date
	 * @param endDate
	 * @return
	 */
	List<Map<String,Object>> getExportAllWxOrder(Map<String, Object> conditions,int type);

	public List<Map<String,Object>> getSendUserData(Integer userId);
	
	/**
	 * 获取订单明细
	 * @param orgId
	 * @param virtId
	 * @param isFree  ==1获取所有工单数的明细 ==0获取收费工单数的明细
	 * @param type
	 * @param date
	 * @param endDate
	 * @return
	 */
	List<Map<String,Object>> getExportWxAmountOrder(Map<String, Object> conditions, int isFree, int type);


	Page getPeoplecOrderList(Map<String, Object> conditions,int type,int pageNo,int pageSize);

	List<Integer> getAutomaticHighPraiseRepairData();

	Page getBillCommentList(Map<String, Object> conditions,int type,int pageNo,int pageSize);

}
