Commit d44833f1 authored by neo's avatar neo

[dev] UploadEvidenceFile impl

parent 37c45a65
...@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.constant.enums.EnumModule; import pwc.taxtech.atms.constant.enums.EnumModule;
import pwc.taxtech.atms.dto.PagingResultDto; import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto; import pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto;
...@@ -24,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.OutputInvoiceServiceImpl; ...@@ -24,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.OutputInvoiceServiceImpl;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -114,23 +116,19 @@ public class OutputInvoiceController { ...@@ -114,23 +116,19 @@ 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() { public ResponseEntity UploadEvidenceFile(String fileName, String tempFileName, String period) {
String userID = identityService.getIdentityUser().getID(); String userID = identityService.getIdentityUser().getID();
String fullPath = fileUploadAdapter.uploadEvidence(this, EnumModule.Evidence, UUID.randomUUID().toString()); String fullPath = fileUploadAdapter.uploadEvidence(this, EnumModule.Evidence, UUID.randomUUID().toString());
if (!StringUtil.isNotEmpty(fullPath)) { if (!StringUtil.isNotEmpty(fullPath)) {
// string fileName = HttpContext.Current.Request.Form["filename"];
// string _tempFileName = HttpContext.Current.Request.Form["tempFileName"];
ImportFile fileDto = new ImportFile(); ImportFile fileDto = new ImportFile();
// { fileDto.setFileID(tempFileName.substring(1, tempFileName.length() - 5));
// FileID = _tempFileName.Substring(1, _tempFileName.Length - 5), fileDto.setFilePath(fullPath);
// FilePath = fullPath, fileDto.setFileName(fileName);
// FileName = fileName, fileDto.setPeriodID(Integer.parseInt(period));
// PeriodID = Convert.ToInt32(HttpContext.Current.Request.Form["period"]), fileDto.setFileType(GetExtension(fileName));
// FileType = Path.GetExtension(fileName), fileDto.setFileImportType(EnumModule.Evidence.getCode());
// FileImportType = (int)EnumModule.Evidence, fileDto.setCreatorID(userID);
// CreatorID = userID, fileDto.setCreateTime(new Date());
// CreateTime = DateTime.Now
// };
return ResponseEntity.ok(outputInvoiceService.addImportFile(fileDto)); return ResponseEntity.ok(outputInvoiceService.addImportFile(fileDto));
} }
return ResponseEntity.ok(false); return ResponseEntity.ok(false);
...@@ -141,5 +139,9 @@ public class OutputInvoiceController { ...@@ -141,5 +139,9 @@ public class OutputInvoiceController {
return ResponseEntity.ok(outputInvoiceService.GetOutputInvoiceList(period)); return ResponseEntity.ok(outputInvoiceService.GetOutputInvoiceList(period));
} }
private String GetExtension(String file) {
return file.substring(file.lastIndexOf(".") + 1, file.length()
- file.lastIndexOf("."));
}
} }
...@@ -239,7 +239,8 @@ public class OutputInvoiceServiceImpl extends VatAbstractService { ...@@ -239,7 +239,8 @@ public class OutputInvoiceServiceImpl extends VatAbstractService {
} }
public Boolean addImportFile(ImportFile fileDto) { public Boolean addImportFile(ImportFile fileDto) {
return null; importFileMapper.insert(fileDto);
return true;
} }
public OperationResultDto<List<OutputVATInvoiceInfoDto>> GetOutputInvoiceList(int period) { public OperationResultDto<List<OutputVATInvoiceInfoDto>> GetOutputInvoiceList(int period) {
......
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