package com.jianshui.invoiceall.utils;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

import java.util.Map;

/**
 * Vo生成
 * @author kk
 * @date 2022年12月09日 17:41
 */
public class GenVoCodeTest {


    public static void main(String[] args) {

        String json  = "{\n" +
                "            \"fpqqlsh\": \"发票请求流水号\",\n" +
                "            \"fphm\": \"全电发票号码\",\n" +
                "            \"gmfnsrsbh\": \"购买方税号\",\n" +
                "            \"gmfmc\": \"购买方名称\",\n" +
                "            \"kprq\": \"开票日期\",\n" +
                "            \"xsfmc\": \"销售方名称\",\n" +
                "            \"xsfnsrsbh\": \"销售方税号\",\n" +
                "            \"zzfpdm\": \"全电纸票发票代码\",\n" +
                "            \"zzfphm\": \"全电纸票发票号码\",\n" +
                "            \"ewmUrl\": \"发票二维码下载地址\",\n" +
                "            \"pdfUrl\": \"PDF下载地址\",\n" +
                "            \"ofdUrl\": \"OFD下载地址\",\n" +
                "            \"xmlUrl\": \"XML下载地址\",\n" +
                "            \"error\":\"异常信息\"\n" +
                "        }";

        JSONObject jsonObject = JSONUtil.parseObj(json);

        String result = "";

        for (Map.Entry<String, Object> objectEntry : jsonObject) {
            result = result + " @NotEmpty\n@ApiModelProperty(value = \""+objectEntry.getValue()+"\") \n private String "+objectEntry.getKey()+";\n\n";
        }

        System.out.println(result);
    }


}
