package com.zfire.mall.manager.logic.k3.bill;

import cn.hutool.core.collection.CollectionUtil;
import com.zfire.mall.manager.bean.k3.bill.SalesOrderBean;
import com.zfire.mall.manager.bean.k3.bill.result.ResultBean;
import com.zfire.mall.manager.bean.k3.bill.result.ResultEntity;
import com.zfire.mall.manager.bean.k3.bill.result.SuccessEntitys;
import com.zfire.mall.manager.constant.KingDeeCons;
import com.zfire.mall.manager.exception.RemoteServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * 收款单-金蝶对接
 */
@Slf4j
@Service
public class K3ReceiptBillLogic extends CommonOrderLogic{

    /**
     * 反审核销售订单根据id
     * @param id
     * @return
     */
    public boolean unAuditById(String id,String billType) {
        try {
            if(billType.equals("1")) {
                return super.unAudit(getQueryId(), id, KingDeeCons.WALLET_SKD);
            }else if(billType.equals("2")){
                return super.unAudit(getQueryId(), id, KingDeeCons.WALLET_TKD);
            }else{
                return super.unAudit(getQueryId(),id,KingDeeCons.WALLET_FKD);
            }
        } catch (Exception e) {
            log.error("收款单/退款单根据单据ID反审失败！原因:", e);
            return false;
        }
    }

    /**
     * 反审核销售订单根据单据编号
     * @param billNo
     * @return
     */
    public boolean unAuditByBillNo(String billNo,String billType) {
        try {
            if(billType.equals("1")) {
                return super.unAudit(getQueryBillNo(), billNo, KingDeeCons.WALLET_SKD);
            }else if(billType.equals("2")){
                return super.unAudit(getQueryBillNo(), billNo, KingDeeCons.WALLET_TKD);
            }else{
                return super.unAudit(getQueryBillNo(),billNo,KingDeeCons.WALLET_FKD);
            }
        } catch (Exception e) {
            log.error("收款单/退款单根据单据编号反审失败！原因:", e);
            return false;
        }
    }

}
