package com.prolog.cs.base.gsp.controller; 

import com.alibaba.fastjson.JSON;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;
import com.prolog.cs.base.gsp.model.GspUnqualifiedLoss;
import com.prolog.cs.data.exchange.client.ExchangeSender;
import com.prolog.cs.data.exchange.client.core.EtlMessage;
import com.prolog.cs.data.exchange.client.core.EtlTypeConstants;
import com.prolog.framework.authority.util.HystrixVarUtil;
import com.prolog.framework.common.message.RestMessage;
import org.junit.After;
import org.junit.Before;
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;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
@WebAppConfiguration 
public class GspUnqualifiedLossControllerTest { 

    @Autowired
    private GspUnqualifiedLossController GspUnqualifiedLossController;

    @Autowired
    private ExchangeSender exchangeSender;

    @Before
    public void before() throws Exception { 
        HystrixRequestContext context = HystrixRequestContext.initializeContext();
        HystrixVarUtil.setUserKey("kzywms-admin");
        HystrixVarUtil.setUserKey("syyl-admin");
    }
    
    @After
    public void after() throws Exception { 
    } 

    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.add()));
    public void testAdd() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.delIds()));
    public void testDelIds() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.listPage()));
    public void testListPage() throws Exception {
        System.out.println(JSON.toJSONString(GspUnqualifiedLossController.listPage(
                "736948213336117248","XIANTAO2021",
                "10",11,1)));
    } 
    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.findDetailByMstId()));
    public void testFindDetailByMstId() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.batchAuditYes()));
    public void testBatchAuditYes() throws Exception {
        EtlMessage em = new EtlMessage();
        String[] str=new String[]{
//                "725052564701319168",
//                "725052844750802944",
//                "725052895241834496",
//                "725059913436499968",
//                "725061235468537856",
//                "725039967021174784",
//                "725061410136133632",
//                "725061458060251136",
//                "725061538171457536",
//                "725061565757394944"

//                "726409404466991104",
//                "726148580892610560",
//                "726148519651577856",
//                "726148442015010816",
//                "726148408569630720",
//                "726148334506610688",
//                "726148231528058880",
//                "726148153543364608",
//                "726148101345251328",
//                "726148017459171328",
//                "726147891156094976"

//                "726480646767251456",
//                "726480677696049152",
//                "726480703851728896",
//                "726776804274212864",

                "731185652095389696"
        };
        em.setId(String.join(",",str));
        em.setEtlType(EtlTypeConstants.gsp_pl_audit_w2o);
        exchangeSender.send(em);
    }
    @Test//System.out.println(JSON.toJSONString(GspUnqualifiedLossController.batchAuditNo()));
    public void testBatchAuditNo() throws Exception { 
        
    } 
        
} 
