package com.hzya.frame.plugin.lets.plugin.sales;

import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.ErrorHeaderDetailsDtoDto;
import org.junit.jupiter.api.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 java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @Author：liuyang
 * @Package：com.hzya.frame.plugin.lets.plugin.sales
 * @Project：kangarooDataCenterV3
 * @name：SoSaleOutPluginInitializerToCTest
 * @Date：2024/7/30 14:21
 * @Filename：SoSaleOutPluginInitializerToCTest
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
class SoSaleOutPluginInitializerToCTest {

    @Autowired
    private SoSaleOutPluginInitializerToC soSaleOutPluginInitializerToC;

    @Autowired
    private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao;

    @Test
    void startImplement() throws Exception {
//        soSaleOutPluginInitializerToC.startImplement(null, null);
//        soSaleOutPluginInitializerToC.queryOfsSaleOrder();

        try {
//            QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
//            soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024081500000001");
//            soSaleOutPluginInitializerToC.getOfsOrder(queryOfsSoSaleOutVo, 1L);

//            soSaleOutPluginInitializerToC.startImplement("2024-04-28 00:00:00", "2024-04-28 23:59:59");

//            ErrorHeaderDetailsDtoDto errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDto();
//            errorHeaderDetailsDtoDto.setNewPushDate(getNewDateStr());
//            errorHeaderDetailsDtoDto.setNewTransmitInfo(message);
//            errorHeaderDetailsDtoDto.setNewstate("N");
//            errorHeaderDetailsDtoDto.setHeader(header);
//            errorHeaderDetailsDtoDto.setDetails(details);
//            errorHeaderDetailsDtoDto.
        } catch (Exception e) {
            e.printStackTrace();
        }

//        try {
//            List<TocofsSaleoutDetailedEntity> tocofsSaleoutDetailedEntities = new ArrayList<>();
//            TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity();
//            tocofsSaleoutDetailedEntity.setNewpushdate("2024-09-05 00:00:03");
//            tocofsSaleoutDetailedEntity.setNewtransmitinfo("错误消息22");
//            tocofsSaleoutDetailedEntity.setNewstate("Y");
//            tocofsSaleoutDetailedEntity.setId("80822338");
//            tocofsSaleoutDetailedEntities.add(tocofsSaleoutDetailedEntity);
//            iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock1(tocofsSaleoutDetailedEntities);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

//        String aaa = "{\"barcode\":\"01031000084\",\"brand_name\":\"护童\",\"brand_no\":\"1\",\"cost_price\":\"0.00\",\"discount\":\"0.00\",\"from_mask\":\"0\",\"gift_type\":\"1\",\"good_prop1\":\"\",\"good_prop2\":\"\",\"good_prop3\":\"\",\"good_prop4\":\"\",\"good_prop5\":\"\",\"good_prop6\":\"\",\"goods_amount\":\"0.0000\",\"goods_count\":\"1.0000\",\"goods_id\":\"4662\",\"goods_name\":\"G501_椅套_奶油桃\",\"goods_no\":\"01031000084\",\"goods_type\":\"1\",\"is_package\":\"false\",\"market_price\":\"0.00\",\"paid\":\"0.00\",\"platform_id\":\"0\",\"position_details_list\":[{\"batch_no\":\"\",\"expire_date\":\"\",\"position_goods_count\":\"1.0000\",\"position_id\":\"-6\",\"position_no\":\"其它未上架\",\"rec_id\":\"644060\",\"stockout_detail_id\":\"830189\"}],\"prop1\":\"\",\"prop2\":\"\",\"prop3\":\"\",\"prop4\":\"\",\"prop5\":\"\",\"prop6\":\"\",\"rec_id\":\"830189\",\"refund_status\":\"0\",\"remark\":\"赠品策略编号:ZP24080204,规则名称:G501 奶油桃，原始单号：4032308235772095218\",\"sale_order_id\":\"1251671\",\"sell_price\":\"0.00\",\"share_amount\":\"0.00\",\"share_post_amount\":\"0.00\",\"share_price\":\"0.00\",\"spec_code\":\"\",\"spec_id\":\"4526\",\"spec_name\":\"G501_椅套_奶油桃\",\"spec_no\":\"01031000084\",\"src_oid\":\"AD202409050010\",\"src_order_detail_id\":\"1251671\",\"src_tid\":\"4032308235772095218\",\"stockout_id\":\"630492\",\"suite_no\":\"\",\"tax_rate\":\"0.00\",\"total_amount\":\"0.00\",\"weight\":\"0.0000\"}";
//        System.out.println(aaa.length());


//        String computingTime = soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-01");
//        soSaleOutPluginInitializerToC.splitDateAndPush(computingTime, "tran");


        String s = "LETS-SH2024032800000001";
        soSaleOutPluginInitializerToC.startImplementStockByCode(s, "tran");
    }
}