package cn.superdesk.uniorder;


import cn.superdesk.uniorder.dto.param.thirdpart.qchjc.api.customer.QchjcCustomerCancelStatementParam;
import cn.superdesk.uniorder.dto.param.thirdpart.qchjc.api.customer.QchjcCustomerMakeInvoiceStatusParam;
import cn.superdesk.uniorder.dubbo.provider.SysServiceApplication;
import cn.superdesk.uniorder.service.thirdpart.qchjc.account.QchjcCustomerStatementService;
import com.alibaba.fastjson2.JSON;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author xc
 * @description
 * @date 2022/5/24 10:54
 */
@SpringBootTest(classes = SysServiceApplication.class)
@RunWith(SpringRunner.class)
public class QchjcCustomerStatusSyncTest {

    @Autowired
    private QchjcCustomerStatementService qchjcCustomerStatementService;

    /**
     * 采购单位开票
     */
    @Test
    public void testMakeInvoice(){
        String param = "{\"invoiceNumberMap\":{\"CIA2022052483611904\":\"22008777\",\"CIA2022052472355584\":\"22074522\"},\"invoiceStatus\":\"2\",\"logisticsCompany\":\"引用异常,数据被删\",\"logisticsCompanyType\":\"目前没有-20220512\",\"operatorDate\":1653360075427,\"operatorId\":\"138\",\"operatorName\":\"杨琨森\",\"processState\":\"积分结算v2.3-发票申请管理-op发起开票-op确认发起(发票种类::电子普通发票)(开票方式::深圳航信电子票)\",\"reconciliationBuyerCode\":\"YWDZ20220523013\"}";
        QchjcCustomerMakeInvoiceStatusParam qchjcCustomerMakeInvoiceStatusParam = JSON.parseObject(param, QchjcCustomerMakeInvoiceStatusParam.class);
        System.out.println(qchjcCustomerMakeInvoiceStatusParam);
        qchjcCustomerStatementService.makeInvoiceStatusSync(qchjcCustomerMakeInvoiceStatusParam);
    }

    /**
     * 采购单位重新对账
     */
    @Test
    public void testCancel() {
        String param = "{\"operatorDate\":1653484103831,\"operatorId\":\"140\",\"operatorName\":\"夏闯\",\"processState\":\"积分结算v2.3-对账单-op重新对账\",\"reconciliationBuyerCode\":\"YWDZ20220523015\"}";
        QchjcCustomerCancelStatementParam qchjcCustomerCancelStatementParam = JSON.parseObject(param, QchjcCustomerCancelStatementParam.class);
        System.out.println(qchjcCustomerCancelStatementParam);
        qchjcCustomerStatementService.statementCancelSync(qchjcCustomerCancelStatementParam);
    }

    @Test
    public void testQchPushReceiveStatus() {
        String param = "";
        qchjcCustomerStatementService.syncStatus(param);
    }
}
