package com.zzsn.knowbase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.zzsn.knowbase.constant.Constants;
import com.zzsn.knowbase.entity.Knowledge;
import com.zzsn.knowbase.service.ILocalFileService;
import com.zzsn.knowbase.util.CodeGenerateUtil;
import org.jsoup.Jsoup;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;

import java.io.File;
import java.io.IOException;

@SpringBootTest
class KnowBaseApplicationTests {

    @Autowired
    private CodeGenerateUtil codeGenerateUtil;
    @Autowired
    private ILocalFileService localFileService;

    public static void main(String[] args) {
        Knowledge knowledge = new Knowledge();
        knowledge.setId("111");
        knowledge.setTitle("222");
        String s1 = JSON.toJSONString(knowledge, SerializerFeature.WriteMapNullValue);
        String s2 = JSON.toJSONString(knowledge);
        System.out.println(s2);
    }

    @Test
    void contextLoads() throws IOException {
//        ResponseEntity<Resource> re = localFileService.download("abc.docx", "E:/aaa/abc.docx");
//        File file = re.getBody().getFile();
//
//        System.out.println(re);

    }

    @Test
    void format() {

        String source = "<a id=\\\"_Toc7881\\\"></a><a id=\\\"_Toc20510\\\"></a><a id=\\\"_Toc1184\\\"></a>引言";
        System.out.println();
    }

}
