package com.goafanti.order.service;

import com.goafanti.common.bo.Result;
import com.goafanti.common.model.*;
import com.goafanti.core.mybatis.page.Pagination;
import com.goafanti.order.bo.*;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface OrderNewService {

	/**
	 * 创建订单
	 * @param uid
	 * @param orderType
	 * @return
	 */
	int createServiceOrder(String uid,Integer userType, Integer orderType,Integer salesType,String channelId,String other);
	/**
	 * 创建项目
	 * @param t
	 */
	InputAddTask addOrderTask(InputAddTask t);

	int addMemberProject(InputAddTask t);
	/**
	 * 修改项目信息
	 * @param t
	 */
	int updateOrderTask(InputAddTask t);
	/**
	 * 删除项目
	 * @param id
	 */
	int delectOrderTask(Integer id);
	/**
	 * 项目详情
	 * @param orderNo
	 */
	 List<TOrderTaskBo> selectOrderTask(String orderNo,Integer type);
	 /**
	  * 订单提交或保存
	  * @param t
	  * @param isSubmit
	  */
	int updateServiceOrder(TOrderNewWithBLOBs t, Integer isSubmit);
	/**
	 * 订单详情
	 * @param orderNo
	 */
	TOrderNewBo getOrderNewDetail(String orderNo);
	/**
	 * 收款截点编辑
	 * @param orderDun
	 */
	int createOrderDun(String orderDun,String orderNo);
	/**
	 * 订单列表
	 */
	Pagination<TOrderNewBo> orderNewList(InputOrderNewListBo in);
	/**
	 * 订单审核
	 * @param orderNo
	 * @param orderStatus
	 * @param object
	 */
	int updateOrderNew(String orderNo, Integer orderStatus,String reason,Integer outsource, TOrderOutsource object);

	/**
	 * 催款订单列表
	 * @param name
	 * @param orderNo
	 * @param starTime
	 * @param endTime
	 * @param pageNo
	 * @param pageSize
	 */
	Pagination<outOrderDunListBo> dunOrderNewList(String name, String orderNo,String contractNo, String starTime, String endTime,Integer specially, String aid,
												  String adminName,String deps,
			Integer newStatus,Integer approval,Integer amountStatus,Integer memberType,Integer pageNo, Integer pageSize);

	Result exportOrderDunData(String name, String orderNo, String contractNo, String starTime, String endTime, Integer specially, String aid, String adminName,
							  String depId, Integer newStatus, Integer approval, Integer amountStatus, Integer memberType,
							  Integer pageNo, Integer pageSize);
	/**
	 * 新增催款记录
	 */
	int createDunLog( String dunId, String dumTime, String remarks, String attUrl);
	/**
	 * 查询催款记录
	 * @param dunId
	 */
	List<TDunLogListBo> selectDunLogList(String dunId);
	/**
	 * 新增退单
	 * @param t
	 */
	int addOrderRefund(TOrderRefundWithBLOBs t);
	/**
	 * 特批审核
	 * @param orderNo
	 * @param confirm
	 */
	int updateApprovalOrder(String orderNo,Integer confirm,String reason);
	/**
	 * 查看收款截点
	 * @param orderNo
	 */
	List<TOrderDun> selectOrderDun(String orderNo);
	/**
	 * 退单列表
	 * @param name
	 * @param orderNo
	 * @param starTime
	 * @param endTime
	 * @param specially
	 * @param pageNo
	 * @param pageSize
	 */
	Pagination<TOrderRefundBo> orderRefundList(String name, String orderNo, String starTime, String endTime, Integer specially,
			Integer pageNo, Integer pageSize);

	boolean checkOrderMain(TOrderTask t);

	boolean chekeOrderStatus(String orderNo);

	boolean chekeApprovalOrderStatus(String orderNo);

	int deleteOrderNew(String orderNo);

	boolean checkOderSettlementAmount(String orderNo);

	boolean checkORderTask(String orderNo);

	boolean chekeProcessStatus(String orderNo);

	int updateOrderOver(String orderNo);

	OrderRefundDetailBo orderRefundDetail(String id);

	int updateOrderRefund(TOrderRefundWithBLOBs t);

	int updatetechnicianBackOrder(String orderNo, String reason);

	void addNewDunNoticAndSendEmail(String orderNo, OutNewOrderDunBo o);

	/**
	 *
	 * @param o
	 * @param type 0正常催款 1 会员提前2个月催款
	 */
	void addTimingTaskNewDunNoticAndSendEmail( OutNewOrderDunBo o,Integer type);

	boolean checkOrderAmount(TOrderNewWithBLOBs t);

	int updateFinance(String orderNo, String newFinance);
	List<TOrderLogBo> selectOrderLog(String orderNo);

	/**
	 *  发送站内信与邮件
	 * @param alist 接受者
	 * @param type 通知类型
	 * @param o 订单
	 * @param adminId 发送者
	 * @param approval 特批
	 * @param tid 项目编号
	 */
	void pushGeneralSendNoticeAndEmail(List<String> alist, Integer type,TOrderNewBo o,String adminId,Integer approval,Integer tid);

	void pushGeneralSendNoticeAndEmail(List<String> alist, Integer type,TOrderNewBo o,String adminId,Integer approval);

	int pushOutsourceProjectAudit(TOrderOutsource o);
	Pagination<OutArrearsDunListBo> arrearsDunList(InputArrearsDunListBo in);
	/**
	 * 	非特批触发订单催款
	 */
	void pushOrderDun(TOrderNew t);
	boolean checkOfficialType(TOrderOutsource o);
	void updateOrderCostAmount(Integer tid,Integer type);

    List<OutStatisticsList> statisticsList(InputStatistics in);

	List<OutProvinceStatisticsList> provinceStatisticsList(InputStatistics in);


	/**
	 * 催款触发订单统计欠款与应收款
	 * @param orderNo 订单编号
	 * @param settlementAmount 已收金额
	 * @param date 日期
	 * @return
	 */
	TOrderMid pushOrderMidDun(String orderNo, BigDecimal settlementAmount, Date date);

	TOrderMid pushOrderMidDun(TOrderNew t);
	/**
	 *  发送邮件
	 * @param type 消息类型
	 * @param b 订单信息
	 *
	 */
	void addNotic(Integer type,  TOrderNewBo b,String str);


	Pagination<TOrderNewBo> statisticsOrderList(InputStatisticsOrderList in);

	int updateSalesType(TOrderNew in);

	int addTaskMid(InputAddTask inputAddTask);
	int addTaskMid(Integer id, String commodityId, String orderNo);
	int addTaskMid(Integer id, String commodityId, String orderNo,Integer change);

	void pushExamineName(TOrderNew t);

    int updateOrderUrl(String orderNo, String contractPictureUrl, String agreementUrl, String serviceContent);

    OrderProcessName getProcessName(String orderNo);

	 void addTTaskMember(Integer id, String serviceLife, String serviceYear, Integer yearSum, String contractTerm);

	int updateTag(String orderNo, Integer tag);



	void financeCountOrderUnauditedSubtraction(TOrderNew use, Integer i);

	void orderNewListDownload(InputOrderNewListBo in, HttpServletResponse response);

    void pushNewSignUser(TOrderNew t2);

    void pushOrderPublicReleaseCount(TOrderNew e);

	List<TOrderNew> selectGetAll();

    Object addOperationGuaranteeAudit(String orderNo, Integer type, String reason);

    void pushDunNodeContent();

	void pushOrderDunContent(TOrderNew e);

	String pushOrderGetDunContent(TOrderNew e);

	void pushOrderMaxDuration();


    Object updateAddGroupChat(TOrderMid us);

    Object pushOrderNewUser();
}
