Commit b6a1b65e authored by frank.xa.zhang's avatar frank.xa.zhang

fixed excel get method

parent 44f8a49e
......@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.common.ApplicationException;
import pwc.taxtech.atms.common.ftp.FTPClientPool;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.service.TemplateService;
import javax.servlet.http.HttpServletResponse;
......@@ -57,21 +58,26 @@ public class TemplateController {
String filePath;
File templateFile;
InputStream inputStream = null;
String templatePath = templateService.getTemplatePath(templateID);
if (StringUtils.isEmpty(templateID)) {
Template template = templateService.getTemplateByID(templateID);
String templatePath = template.getPath();
if (StringUtils.isBlank(templateID)) {
return;
}
if (templatePath == null || StringUtils.isEmpty(templatePath)) {
if (StringUtils.isBlank(templatePath)) {
return;
}
filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templateFile = new File(tempPath + templateService.getTemplatePath(templateID));
templateFile = new File(tempPath + templatePath);
try {
inputStream = new BufferedInputStream(new FileInputStream(templateFile));
//如果是系统报表就取本地文件夹,如果不是就取FTP
if (template.getIsSystemType()) {
inputStream = new BufferedInputStream(new FileInputStream(templateFile));
} else {
inputStream = ftpClientPool.download(templatePath);
}
//客户端保存的文件名
String customFileName = "template_" + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName + "\""));
......
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.entitiy.Template;
import java.util.List;
......@@ -14,6 +15,8 @@ public interface TemplateService {
String getTemplatePath(String templateID);
Template getTemplateByID(String templateID);
List<TemplateUniqDto> getTemplateUniqList(String serviceTypeID, Integer payTaxType, Integer reportType, String industryIDs);
OperationResultDto<Object> updateTemplateName(UpateNameParam param);
......
......@@ -58,6 +58,11 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
return result;
}
@Override
public Template getTemplateByID(String templateID) {
return templateMapper.selectByPrimaryKey(templateID);
}
@Override
public List<TemplateUniqDto> getTemplateUniqList(String serviceTypeID, Integer payTaxType, Integer reportType, String industryIDs) {
......
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