package com.tofly.qualitycontrol.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tofly.qualitycontrol.dto.*;
import com.tofly.qualitycontrol.entity.CertificationOrder;
import com.tofly.qualitycontrol.entity.Massaudit;
import com.tofly.qualitycontrol.entity.RectifyOrder;
import com.tofly.qualitycontrol.vo.*;
import org.springframework.web.multipart.MultipartFile;

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

/**
 * 整改服务
 *
 * @author B
 */
public interface IRectifyOrderService extends IService<RectifyOrder> {

	/**
	 * * 整改下达 推送消息 上传文件 第一版-废弃
	 *
	 * @return java.lang.Boolean
	 **/
	Boolean updateRectifyIssue(RectifyOrder rectifyOrder,List<MultipartFile> fileList,String executeAdvice);

	/**
	 * 第二版-废弃
	 * @return java.lang.Boolean
	 */
	Boolean updateRectifyIssue(RectifyOrder rectifyOrder, List<MultipartFile> fileList, String executeAdvice, Massaudit maudit);

	Boolean updateRectifyIssue(NewRectifyIssueDto dto,List<MultipartFile> fileList);

	/**
	 * 分页和模糊查询整改下达
	 *
	 * @param orderDto
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyResultOrderVO_L>
	 **/
	IPage<RectifyOrderListVo> getRectifyIssueList(ReportOrderDto orderDto, Page<RectifyOrder> page);

	/**
	 * 查询整改下达详情
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.CertificationOrderVO_D
	 **/
	RectifyIssueOrderVO_D getRectifyIssueDetail(Long id);

	/**
	 * 处理整改处置 推送消息
	 *
	 * @param rectifyOrder
	 * @return java.lang.Boolean
	 **/
	Boolean updateRectifyResult(RectifyOrder rectifyOrder,List<MultipartFile> fileList,String executeAdvice,String transferIdea);

	/**
	 * 分页和模糊查询整改处置
	 *
	 * @param orderDto
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyResultOrderVO_L>
	 **/
	IPage<RectifyOrderListVo> getRectifyResultList(ReportOrderDto orderDto, Page<RectifyOrder> page);

	/**
	 * 查询整改处置工单详情
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.CertificationOrderVO_D
	 **/
	RectifyResultOrderVO_D getRectifyResultDetail(Long id);

	/**
	 * 处理整改审核 推送消息
	 *
	 * @param rectifyOrder
	 * @return java.lang.Boolean
	 **/
	Boolean updateRectifyAudit(RectifyOrder rectifyOrder,String executeAdvice);

	/**
	 * 分页和模糊查询整改审核
	 *
	 * @param orderDto
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyAuditOrderVO_L>
	 **/
	IPage<RectifyOrderListVo> getRectifyAuditList(ReportOrderDto orderDto, Page page);

	/**
	 * 查询审核结果工单详情
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.CertificationOrderVO_D
	 **/
	RectifyAuditOrderVO_D getRectifyAuditDetail(Long id);

	/**
	 * 处理整改验证 推送消息
	 *
	 * @param rectifyOrder
	 * @return java.lang.Boolean
	 **/
	Boolean updateRectifyVerify(RectifyOrder rectifyOrder,String executeAdvice);

	/**
	 * 分页和模糊查询整改验证
	 *
	 * @param orderDto 查询条件
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyVerifyOrderVO_L>
	 **/
	IPage<RectifyOrderListVo> getRectifyVerifyList(ReportOrderDto orderDto, Page page);

	/**
	 * 查询验证结果工单详情
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.CertificationOrderVO_D
	 **/
	RectifyVerifyOrderVO_D getRectifyVerifyDetail(Long id);

	/**
	 * 验证审核
	 *
	 * @param rectifyOrder
	 * @return java.lang.Boolean
	 **/
	Boolean updateRectifyValidate(RectifyOrder rectifyOrder,String executeAdvice);
	//第二版代码 废弃
	Boolean updateRectifyValidate(RectifyValidateDto dto);

	Boolean updateRectifyValidate(NewRectifyIssueDto dto, List<MultipartFile> fileList);

	/**
	 * 分页和模糊查询整改下达
	 *
	 * @param startDate
	 * @param endDate
	 * @param number
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyResultOrderVO_L>
	 **/
	/**
	 * 验证审核 分页和模糊查询
	 *
	 * @param orderDto
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.RectifyValidateOrderVO_L>
	 **/
	IPage<RectifyOrderListVo> getRectifyValidateList(ReportOrderDto orderDto, Page page);

	/**
	 * 验证审核详情
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.RectifyValidateOrderVO_D
	 **/
	RectifyValidateOrderVO_D getRectifyValidateDetail(Long id);

	/**
	 * 分页和模糊查询业务监控
	 *
	 * @param startDate
	 * @param endDate
	 * @param number
	 * @param currentProcess
	 * @param orderExceptionStatus
	 * @param page
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.tofly.qualitycontrol.vo.BusinessMonitorVO_L>
	 **/
	IPage<BusinessMonitorVO_L> getBusinessMonitorList(Date startDate, Date endDate, String number, String currentProcess, Integer orderExceptionStatus, Page<CertificationOrder> page);

	/**
	 * 获取对应认证工单的所有环节的对应信息
	 *
	 * @param id
	 * @return com.tofly.qualitycontrol.vo.BusinessMonitorVO_D
	 **/
	BusinessMonitorVO_D getAllDetail(Long id);

	/**
	 * 通过认证编号获取认证详细
	 *
	 * @param certificationNumber
	 * @return com.tofly.qualitycontrol.vo.CertificationOrderVO_D
	 **/
	CertificationOrderVO_D getCertificationOrderDetail(String certificationNumber);

	/**
	 * 定时扫描符合条件工单,更新超时和驳回异常状态
	 *
	 * @param
	 * @return void
	 **/
	void scanAndUpdate();

	/**
	 * 每天定时发消息 提醒超时任务
	 *
	 * @param
	 * @return void
	 **/
	void remindOverdueTasks();

	/**
	 * 质检工单整改下达汇总列表
	 * @param dto 查询条件
	 * @return
	 */
    List<ReportSummaryVo> getIssueSummary(OrderDto dto);

	/**
	 * 质检工单整改处置汇总列表
	 * @param dto 查询条件
	 * @return
	 */
	List<ReportSummaryVo> getRectifySummary(OrderDto dto);

	/**
	 * 质检工单整改审核汇总列表
	 * @param dto 查询条件
	 * @return
	 */
	List<ReportSummaryVo> getAuditSummary(OrderDto dto);

	/**
	 * 质检工单整改验证汇总列表
	 * @param dto
	 * @return
	 */
    List<ReportSummaryVo> getVerifySummary(OrderDto dto);

	/**
	 * 质检工单验证审核汇总列表
	 * @param dto
	 * @return
	 */
	List<ReportSummaryVo> getValidateSummary(OrderDto dto);

	List<RectifySummaryVo> getOrderRectify(OrderReportDto dto);

	List<Map<String,Object>> getEconomyBenefit(OrderReportDto dto);

}
