package com.goafanti.order.service;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;

import com.goafanti.common.model.OrganizationManagement;
import com.goafanti.common.model.TOrderDetail;
import com.goafanti.core.mybatis.page.Pagination;
import com.goafanti.customer.bo.FollowBusinessBo;
import com.goafanti.order.bo.BillDetailBo;
import com.goafanti.order.bo.BillListBo;
import com.goafanti.order.bo.OrderListBo;
import com.goafanti.order.bo.ServiceOrderDetailBo;
import com.goafanti.order.bo.C2BOrderDetailBo;
import com.goafanti.order.bo.C2COrderDetailBo;
import com.goafanti.order.bo.OrderChangeBo;

public interface OrderService {
	
	/**
	 * 查询商品详情
	 * @param commodityId 商品id
	 * @param orderType 订单类型
	 * @return
	 */
	C2COrderDetailBo selectCommodityDetail(String commodityId,Integer orderType);

	/**
	 * 添加意向
	 * @param orderNo 订单编号
	 * @param commodityId 商品id
	 * @param commodityMode 商品型号
	 * @param commodityQuantity 商品数量
	 * @param commodityType 商品类型
	 * @param createTime 创建时间
	 * @param remarks 备注
	 * @return
	 */
	int addIntention(String orderNo, String commodityId, String commodityMode, Integer commodityQuantity,Integer commodityType,
			String createTime, String remarks) throws ParseException ;

	/**
	 * 支付定金
	 * @param orderNo 订单编号
	 * @param fundAmount 金额
	 * @return remarks 备注
	 */
	int updatePayForFirst(String orderNo, BigDecimal fundAmount,String remarks);

	/**
	 * 退款操作
	 * @param orderNo
	 * @param refundAmount
	 * @return
	 */
	int updateRefundForTest(String orderNo, String refundAmount);
	
	/**
	 * 支付尾款
	 * @param orderNo 订单编号
	 * @param fundAmount 金额
	 * @param remarks 备注
	 * @return
	 */
	int updatePayForLast(String orderNo, BigDecimal fundAmount, String remarks);

	/**
	 * 
	 * @param confirm 是否
	 * @return
	 */
	Pagination<C2BOrderDetailBo> selectOrderList(boolean confirm,Integer pageNo,Integer PageSize);

	/**
	 * 查询订单详情
	 * @param orderNo
	 * @return
	 */
	C2BOrderDetailBo selectOrderDetail(String orderNo);

	/**
	 * 用户查询流水记录
	 * @param orderNo
	 * @return
	 */
	Pagination<BillListBo> selectOrderBillList(String orderNo,Integer pageNo,Integer pageSize);

	/**
	 * 提现
	 * @param orderNo
	 * @return
	 */
	int updateApplyForWithdraw(String orderNo,String remarks);

	/**
	 * 取消订单
	 * @param orderNo
	 * @return
	 */
	int updateApplyForCancel(String orderNo);

	/**
	 * 确认意向订单
	 * @param orderNo 订单编号
	 * @param confirm 是否确认
	 * @return
	 */
	int updateConfirmIntention(String orderNo, boolean confirm);
	
	
	/**
	 * 服务订单详情
	 * @param orderNo
	 * @return
	 */
	ServiceOrderDetailBo selectServiceOrderDetail(String orderNo);

	/**
	 * 签单
	 * @param orderNo
	 * @param firstPayment
	 * @param orderAmount
	 * @param signFirstPayment
	 * @param signTotalAmount
	 * @param approval
	 * @param orderRemarks
	 * @return
	 */
	int updateSignServiceOrder(String orderNo,String contractNo,String signFirstPayment, String signTotalAmount,
			String approval,String orderRemarks,String signTime);

	/**
	 * 作废订单
	 * @param orderNo
	 * @return
	 */
	int updateRevokeOrder(String orderNo);

	/**
	 * 添加订单商品
	 * @param orderNo
	 * @param commodityId
	 * @param commodityMode
	 * @param commodityQuantity
	 * @param commodityType
	 * @param discountPrice
	 * @param remarks
	 * @return
	 */
	int addOrderCommodity(String orderNo, String commodityId, String commodityName,String commodityMode, Integer commodityQuantity,Integer commodityType,
			String commodityPrice, String discountPrice,String commodityFirstPayment,String discountFirstPayment, String remarks);
	
	/**
	 * 修改商品信息
	 * @param detailId
	 * @param orderNo
	 * @param discountPrice
	 * @param discountFirstPayment
	 * @param remarks
	 * @return
	 */
	int updateOrderCommodity(String detailId,String discountPrice,String discountFirstPayment,Integer commodityQuantity,String remarks);

	/**
	 * 删除订单商品
	 * @param detailId
	 * @return
	 */
	int deleteOrderCommodity(String detailId);
	
	/**
	 * 查询分管部门
	 * @return
	 */
	List<OrganizationManagement> selectMyDeps();
	


	/**
	 * 创建订单
	 * @param uid
	 * @param orderType
	 * @param contractType 合同类型
	 * @return
	 */
	int createServiceOrder(String uid, Integer orderType,String contractType);

	/**
	 * 查询公共订单
	 * @return
	 */
	Pagination<OrderListBo> selectPublicOrder(OrderListBo bo,String startDate,String endDate,Integer pageNo, Integer pageSize);
	
	/**
	 * 指定的营销员
	 * @param orderNo
	 * @param salesmanId
	 * @return
	 */
	int updateAppointSalesman(String orderNo,String salesmanId);
	
	/**
	 * 
	 * @param orderNo
	 * @param depId
	 * @param buyerName
	 * @param salesmanId
	 * @param salesmanName
	 * @param financeName
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Pagination<OrderListBo> selectSettlementList(String orderNo, String depId,String buyerName,String salesmanName,  
			String financeId,String financeName,Integer orderStatus,Integer liquidationStatus,Integer approval,Integer isDistributionFinance,
			String startDate,String endDate,Integer pageNo, Integer pageSize);
	
	/**
	 * 我的订单流水(财务负责人课件)
	 * @param payeeName 收款人
	 * @param payerName 付款人
	 * @param depId 部门id
	 * @param salesmanName 营销员
	 * @param orderNo 订单编号
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Pagination<BillListBo> selectMyBillList(String payeeName,String payerName,String depId,String salesmanName,String orderNo,
			 Integer confirmSign,Integer deleteSign,Integer pageNo,Integer pageSize);
	

	/**
	 * 我的订单流水查询（与订单相关的人员可见）
	 * @param payeeName 收款人
	 * @param payerName 付款人
	 * @param depId 部门id
	 * @param salesmanName 营销员
	 * @param orderNo 订单编号
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Pagination<BillListBo> queryMyBillList(String payeeName,String payerName,String depId,String salesmanName,String orderNo,
			 Integer confirmSign,Integer deleteSign,Integer pageNo,Integer pageSize);
	
	
	/**
	 * 所有订单流水查询
	 * @param payeeName
	 * @param payerName
	 * @param depId
	 * @param salesmanName
	 * @param orderNo
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Pagination<BillListBo> queryAllBillList(String payeeName,String payerName,String depId,String salesmanName,String financeName,String orderNo,
			 Integer confirmSign,Integer deleteSign,Integer pageNo,Integer pageSize);
	
	/**
	 * 查看流水详情
	 * @param billNo
	 * @return
	 */
	BillDetailBo selectBillDetail(String billNo);

	
	/**
	 * 修改露水订单
	 * @param billNo
	 * @param orderNo
	 * @param confrim
	 * @return
	 */
	int updateBill(String billNo,String orderNo,String financialPayNo,String financialPayTime,String remarks);

	
	/**
	 * 查询待立项订单
	 * @param bo
	 * @param startDate
	 * @param endDate
	 * @param depId
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	Pagination<OrderListBo> listSetUpServiceOrder(String buyerName,String salesmanName, String financeName,
			String depId,Integer approval, Integer pageNo, Integer pageSize);

	
	/**
	 * 订单编号
	 * @param orderNo
	 * @return
	 */
	List<TOrderDetail> selectOrderCommodity(String orderNo);
	
	/**
	 * 支付（测试用）
	 * @param orderNo
	 * @param payAmount
	 * @return
	 */
	int updatePayForTest(String orderNo,String payAmount);

	/**
	 * 分配订单
	 * @param orderNo
	 * @param financeId
	 * @return
	 */
	int updateDistributionOrder(String orderNo, String financeId);

	/**
	 * 锁定、解锁、废除
	 * @param orderNo
	 * @param operatorType
	 * @return
	 */
	int updateLockOrRevokeOrder(String orderNo, Integer operatorType);

	/**
	 * 查询单笔订单流水
	 * @param orderNo
	 * @return
	 */
	List<BillListBo> selectBillByOrderNo(String orderNo);

	/**
	 * 申请退款(买家)
	 * @param orderNo
	 * @return
	 */
	int updateApplyForRefund(String orderNo);

	/**
	 * 确认退款(买家)
	 * @param orderNo
	 * @return
	 */
	int updateConfirmRefund(String orderNo,boolean confirm);
	

	
	/**
	 * PC端添加意向
	 * @param orderNo 订单编号
	 * @param commodityId 商品id
	 * @param commodityMode 商品型号
	 * @param commodityQuantity 商品数量
	 * @param commodityType 商品类型
	 * @param createTime 创建时间
	 * @param remarks 备注
	 * @return
	 */
	int addPurpose(String orderNo, String commodityId, String commodityMode, Integer commodityQuantity,Integer commodityType, 
			String createTime,String remarks) throws ParseException;

	/**
	 * 添加变更记录
	 * @param orderNo
	 * @param changeComment
	 * @param dunList 
	 * @param taskList 
	 * @return
	 */
	int addOrderChange(String orderNo, String changeComment, String taskList, String dunList);

	/**
	 * 查看变更记录列表
	 * @param orderNo
	 * @return
	 */
	List<OrderChangeBo> selectOrderChange(String orderNo);

	/**
	 * 删除变更记录
	 * @param changeId
	 * @return
	 */
	int deleteOrderChange(String changeId);

	/**
	 * 修改变更记录
	 * @param changeId
	 * @param changeComment
	 * @param changeStatus
	 * @return
	 */
	int updateOrderChange(String changeId, String changeComment, Integer changeStatus);


	void addContractTaskLog();

	boolean checkCustomerInformation(String uid);

	int addBusinessProjectId(FollowBusinessBo fbb);

	

	
}
