|
@@ -26,8 +26,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
public class ExportProperty {
|
|
|
private static Logger logger = LogManager.getLogger(ExportProperty.class);
|
|
|
- private static String dbName="yunkai_240612";
|
|
|
- private final static String sourceDir = "d:/yunkai/";
|
|
|
public static void main(String[] args) {
|
|
|
logger.debug("导出开始");
|
|
|
try {
|
|
@@ -39,9 +37,9 @@ public class ExportProperty {
|
|
|
}
|
|
|
|
|
|
private static void dispose() {
|
|
|
- File dir=new File(sourceDir+"prop/");
|
|
|
+ File dir=new File(Param.dataDir+"/prop/");
|
|
|
if(dir.exists()) {
|
|
|
- FileUtil.clearDirectory(sourceDir+"prop/");
|
|
|
+ FileUtil.clearDirectory(Param.dataDir+"/prop/");
|
|
|
}else {
|
|
|
dir.mkdirs();
|
|
|
}
|
|
@@ -50,11 +48,11 @@ public class ExportProperty {
|
|
|
try {
|
|
|
Class.forName("com.mysql.cj.jdbc.Driver");
|
|
|
|
|
|
- String url = "jdbc:mysql://localhost:3306/"+dbName+"?serverTimezone=GMT%2B8";
|
|
|
+ String url = "jdbc:mysql://localhost:3306/"+Param.dbName+"?serverTimezone=GMT%2B8";
|
|
|
|
|
|
- String user = "root";
|
|
|
+ String user = Param.dbUser;
|
|
|
|
|
|
- String password = "123456";
|
|
|
+ String password = Param.dbPass;
|
|
|
connect = DriverManager.getConnection(url, user, password);
|
|
|
exportProperty(connect);
|
|
|
} catch (Exception e) {
|
|
@@ -80,7 +78,7 @@ public class ExportProperty {
|
|
|
List<PropertyDto> props=getProperty(connect, code);
|
|
|
if(CollectionUtils.isNotEmpty(props)) {
|
|
|
total++;
|
|
|
- FileUtil.writeFile(sourceDir+"prop/", code+".json", JSONObject.toJSONString(props));
|
|
|
+ FileUtil.writeFile(Param.dataDir+"/prop/", code+".json", JSONObject.toJSONString(props));
|
|
|
}else {
|
|
|
System.out.println("无文件:"+code);
|
|
|
}
|
|
@@ -91,7 +89,7 @@ public class ExportProperty {
|
|
|
Set<String> list = new HashSet<>();
|
|
|
XSSFWorkbook wb = null;
|
|
|
try {
|
|
|
- wb = new XSSFWorkbook(sourceDir + "subject_info.xlsx");
|
|
|
+ wb = new XSSFWorkbook(Param.dataDir + "/subject_info.xlsx");
|
|
|
XSSFSheet sheet = wb.getSheetAt(0);
|
|
|
int rows = sheet.getLastRowNum();
|
|
|
for (int i = 1; i <= rows; i++) {
|
|
@@ -112,6 +110,10 @@ public class ExportProperty {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+// private static String formatCode(String code) {
|
|
|
+// return code.replaceAll("-", "*");
|
|
|
+// }
|
|
|
+
|
|
|
private static List<PropertyDto> getProperty(Connection connect, String subjectCode) throws SQLException, IOException {
|
|
|
List<PropertyDto> as = new ArrayList<>();
|
|
|
PreparedStatement preState = null;
|