Commit a323707f authored by neo's avatar neo

[bugfix] get filename and temp file name from form

parent 18d4ab34
...@@ -33,6 +33,9 @@ public final class Constant { ...@@ -33,6 +33,9 @@ public final class Constant {
public static final String IMAGE_PATH_SUCCESS = CURRENT_IMAGE_PATH + File.separator + "success.png"; public static final String IMAGE_PATH_SUCCESS = CURRENT_IMAGE_PATH + File.separator + "success.png";
public static final String IMAGE_PATH_WARN = CURRENT_IMAGE_PATH + File.separator + "warning1.png"; public static final String IMAGE_PATH_WARN = CURRENT_IMAGE_PATH + File.separator + "warning1.png";
public static final String FILE_NAME = "filename";
public static final String TEMP_FILE_NAME = "tempFileName";
public static final boolean DEFAULT_RESULT = true; public static final boolean DEFAULT_RESULT = true;
......
...@@ -33,6 +33,8 @@ import java.util.UUID; ...@@ -33,6 +33,8 @@ import java.util.UUID;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT; import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
import static pwc.taxtech.atms.constant.Constant.FILE_NAME;
import static pwc.taxtech.atms.constant.Constant.TEMP_FILE_NAME;
@RestController @RestController
@RequestMapping(value = "api/v1/outputInvoiceImport") @RequestMapping(value = "api/v1/outputInvoiceImport")
...@@ -116,10 +118,13 @@ public class OutputInvoiceController { ...@@ -116,10 +118,13 @@ public class OutputInvoiceController {
} }
@RequestMapping(value = "UploadEvidenceFile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "UploadEvidenceFile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity UploadEvidenceFile(String fileName, String tempFileName, String period, MultipartHttpServletRequest request) { public ResponseEntity UploadEvidenceFile(String period, MultipartHttpServletRequest request) {
String userID = identityService.getIdentityUser().getID(); String userID = identityService.getIdentityUser().getID();
String fullPath = fileUploadAdapter.uploadEvidence(request, EnumModule.Evidence, userID); String fullPath = fileUploadAdapter.uploadEvidence(request, EnumModule.Evidence, userID);
if (StringUtil.isNotEmpty(fullPath)) { if (StringUtil.isNotEmpty(fullPath)) {
String fileName = request.getParameter(FILE_NAME);
String tempFileName = request.getParameter(TEMP_FILE_NAME);
ImportFile fileDto = new ImportFile(); ImportFile fileDto = new ImportFile();
fileDto.setFileID(tempFileName.substring(1, tempFileName.length() - 5)); fileDto.setFileID(tempFileName.substring(1, tempFileName.length() - 5));
fileDto.setFilePath(fullPath); fileDto.setFilePath(fullPath);
......
...@@ -20,6 +20,8 @@ import java.util.Date; ...@@ -20,6 +20,8 @@ import java.util.Date;
import java.util.UUID; import java.util.UUID;
import static pwc.taxtech.atms.constant.Constant.CURRENT_USER_UPLOAD_FOLDER; import static pwc.taxtech.atms.constant.Constant.CURRENT_USER_UPLOAD_FOLDER;
import static pwc.taxtech.atms.constant.Constant.FILE_NAME;
import static pwc.taxtech.atms.constant.Constant.TEMP_FILE_NAME;
@Service @Service
public class FileUploadAdapter { public class FileUploadAdapter {
...@@ -28,10 +30,10 @@ public class FileUploadAdapter { ...@@ -28,10 +30,10 @@ public class FileUploadAdapter {
@Value("${max_file_length}") @Value("${max_file_length}")
private String maxFileSize; private String maxFileSize;
static final String FILE_NAME = "filename";
private String _baseFolder; private String _baseFolder;
public static FileParamBean CacheFileBean; public static FileParamBean CacheFileBean;
public static final String TEMP_FILE_NAME = "tempFileName";
public static final String CHUNK_NUMBER = "_chunkNumber"; public static final String CHUNK_NUMBER = "_chunkNumber";
public static final String CHUNK_SIZE = "_chunkSize"; public static final String CHUNK_SIZE = "_chunkSize";
public static final String TOTAL_SIZE = "_totalSize"; public static final String TOTAL_SIZE = "_totalSize";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment