|
@@ -32,17 +32,18 @@ public class ExcelToTxtTask extends AbstractTask {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void execute() {
|
|
protected void execute() {
|
|
- String fileSuffix = FileHelper.getFileSuffix(SysProperty.DATA_FILE);
|
|
|
|
|
|
+ String filePath=SysProperty.DATA_DIR+"/"+SysProperty.DATA_FILE;
|
|
|
|
+ String fileSuffix = FileHelper.getFileSuffix(filePath);
|
|
if (!fileSuffix.endsWith(".xls") && !fileSuffix.endsWith(".xlsx")) {
|
|
if (!fileSuffix.endsWith(".xls") && !fileSuffix.endsWith(".xlsx")) {
|
|
throw new StatusException("目前仅支持后缀名为“.xls“或”.xlsx”的文件!");
|
|
throw new StatusException("目前仅支持后缀名为“.xls“或”.xlsx”的文件!");
|
|
}
|
|
}
|
|
|
|
|
|
- File excelFile = new File(SysProperty.DATA_FILE);
|
|
|
|
|
|
+ File excelFile = new File(filePath);
|
|
if (!excelFile.exists()) {
|
|
if (!excelFile.exists()) {
|
|
- throw new StatusException("Excel文件不存在!" + SysProperty.DATA_FILE);
|
|
|
|
|
|
+ throw new StatusException("Excel文件不存在!" + filePath);
|
|
}
|
|
}
|
|
|
|
|
|
- String txtFilePath = SysProperty.DATA_FILE.replace(fileSuffix, ".txt");
|
|
|
|
|
|
+ String txtFilePath = filePath.replace(fileSuffix, ".txt");
|
|
File txtFile = new File(txtFilePath);
|
|
File txtFile = new File(txtFilePath);
|
|
if (txtFile.exists()) {
|
|
if (txtFile.exists()) {
|
|
FileUtils.deleteQuietly(txtFile);
|
|
FileUtils.deleteQuietly(txtFile);
|