weaver-hrm-salary/test/ParseTaxApi.java

93 lines
2.8 KiB
Java
Raw Normal View History

2023-10-11 18:24:02 +08:00
import com.engine.salary.util.excel.ExcelParseHelper;
import org.apache.commons.lang3.StringUtils;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
public class ParseTaxApi {
public static void main(String[] args) {
2024-03-29 10:44:55 +08:00
readExcel("H:\\code\\salary\\test\\ApiDes.xlsx");
2023-12-06 15:19:07 +08:00
2024-03-29 10:44:55 +08:00
// readExcel2("H:\\code\\salary\\test\\ApiDes.xlsx");
2023-10-11 18:24:02 +08:00
}
public static void readExcel(String path) {
try {
// 获取文件输入流
InputStream inputStream = new FileInputStream(path);
List<ApiDes> apiDesList = ExcelParseHelper.parse2Map(inputStream, ApiDes.class, 0, 1, 5, "ApiDes.xlsx");
/**
* 字段名称 字段含义 字段类型 必填 说明
* qtzzlx 其他证件类型 String(64) 条件必填 见证件类型字典
*
* private String qtzzlx;
*/
apiDesList.forEach(des -> {
String type = des.getType();
2023-12-06 15:19:07 +08:00
if (StringUtils.isNotEmpty(type)) {
if (type.startsWith("String")) {
type = "String";
2023-10-11 18:24:02 +08:00
}
}
String a = "/** * "
+ des.getMean()
2023-12-06 15:19:07 +08:00
+ " "
2023-10-11 18:24:02 +08:00
+ "必填:" + des.getRequired()
2023-12-06 15:19:07 +08:00
+ " " + (des.getDes() == null ? "" : des.getDes())
2023-10-11 18:24:02 +08:00
+ " */" + " private " + type + " " + des.getName() + ";";
System.out.println(a);
});
} catch (Exception e) {
e.printStackTrace();
}
}
2023-12-06 15:19:07 +08:00
public static void readExcel2(String path) {
try {
// 获取文件输入流
InputStream inputStream = new FileInputStream(path);
List<ApiReturnDes> apiDesList = ExcelParseHelper.parse2Map(inputStream, ApiReturnDes.class, 0, 1, 4, "ApiDes.xlsx");
/**
* 字段名称 字段含义 字段类型 必填 说明
* qtzzlx 其他证件类型 String(64) 条件必填 见证件类型字典
*
* private String qtzzlx;
*/
apiDesList.forEach(des -> {
String type = des.getType();
if (StringUtils.isNotEmpty(type)) {
if (type.startsWith("String")) {
type = "String";
}
}
String a = "/** * "
+ des.getMean()
+ " " + (des.getDes() == null ? "" : des.getDes())
+ " */" + " private " + type + " " + des.getName() + ";";
System.out.println(a);
});
} catch (Exception e) {
e.printStackTrace();
}
}
2023-10-11 18:24:02 +08:00
}