Commit d44833f1 authored by neo's avatar neo

[dev] UploadEvidenceFile impl

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