Commit ed183558 authored by sam.x.wang's avatar sam.x.wang

导出文件名和bug

parent 5a8bd89f
...@@ -23,6 +23,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK; ...@@ -23,6 +23,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
/** /**
* CIT数据预览功能模块Controller * CIT数据预览功能模块Controller
*
* @author zhikai.z.wei * @author zhikai.z.wei
*/ */
@RestController @RestController
...@@ -34,6 +35,7 @@ public class CitDataPreviewController extends BaseController { ...@@ -34,6 +35,7 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 日记账合并版数据的获取 * 日记账合并版数据的获取
*
* @param citJournalAdjustDto * @param citJournalAdjustDto
* @return * @return
*/ */
...@@ -45,12 +47,15 @@ public class CitDataPreviewController extends BaseController { ...@@ -45,12 +47,15 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 日记账合并版导出 * 日记账合并版导出
*
* @param paras * @param paras
* @param response * @param response
*/ */
@RequestMapping(value = "exportJournalMergeData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "exportJournalMergeData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportJournalMergeData(@RequestBody CitJournalAdjustDto paras, HttpServletResponse response) { public void exportJournalMergeData(@RequestBody CitJournalAdjustDto paras, HttpServletResponse response) {
int count = citDataPreviewService.exportJournalMergeData2(paras, response); int count = citDataPreviewService.exportJournalMergeData2(paras, response);
if (count == 0) { if (count == 0) {
response.setStatus(SC_NO_CONTENT); response.setStatus(SC_NO_CONTENT);
} else { } else {
...@@ -61,6 +66,7 @@ public class CitDataPreviewController extends BaseController { ...@@ -61,6 +66,7 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 试算平衡表生成版的数据获取 * 试算平衡表生成版的数据获取
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @return * @return
*/ */
...@@ -72,6 +78,7 @@ public class CitDataPreviewController extends BaseController { ...@@ -72,6 +78,7 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 试算平衡表生成版的导出 * 试算平衡表生成版的导出
*
* @param paras * @param paras
* @param response * @param response
*/ */
...@@ -108,6 +115,7 @@ public class CitDataPreviewController extends BaseController { ...@@ -108,6 +115,7 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 试算平衡表Mapping版的数据获取 * 试算平衡表Mapping版的数据获取
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @return * @return
*/ */
...@@ -120,6 +128,7 @@ public class CitDataPreviewController extends BaseController { ...@@ -120,6 +128,7 @@ public class CitDataPreviewController extends BaseController {
/** /**
* 试算平衡表Mapping版的导出 * 试算平衡表Mapping版的导出
*
* @param paras * @param paras
* @param response * @param response
*/ */
......
...@@ -6,34 +6,22 @@ import com.github.pagehelper.PageInfo; ...@@ -6,34 +6,22 @@ import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.JxlsUtils; import pwc.taxtech.atms.common.util.JxlsUtils;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.CountTypeConstant;
import pwc.taxtech.atms.constant.ExportTemplatePathConstant;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dto.CitJournalAdjustDto;
import pwc.taxtech.atms.dpo.CitTrialBalanceDto; import pwc.taxtech.atms.dpo.CitTrialBalanceDto;
import pwc.taxtech.atms.dto.CitJournalAdjustDto;
import pwc.taxtech.atms.dto.CitTrialBalanceExportDto; import pwc.taxtech.atms.dto.CitTrialBalanceExportDto;
import pwc.taxtech.atms.dto.JournalMergeExportDto; import pwc.taxtech.atms.dto.JournalMergeExportDto;
import pwc.taxtech.atms.dto.export.ExportDto; import pwc.taxtech.atms.dto.export.ExportDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.dto.vatdto.dd.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.dd.*;
import pwc.taxtech.atms.dto.vatdto.excelheader.CashFlowHeader;
import pwc.taxtech.atms.dto.vatdto.excelheader.CertifiedInvoicesListHeader;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.thirdparty.ExcelUtil; import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.TrialBalanceCondition;
import pwc.taxtech.atms.vat.dpo.*;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -41,6 +29,7 @@ import java.util.Map; ...@@ -41,6 +29,7 @@ import java.util.Map;
/** /**
* CIT数据预览功能模块 * CIT数据预览功能模块
*
* @author zhikai.z.wei * @author zhikai.z.wei
* @Date: 02/03/2019 * @Date: 02/03/2019
* @Description: * @Description:
...@@ -61,17 +50,18 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -61,17 +50,18 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 获取日记账合并版 * 获取日记账合并版
*
* @param citJournalAdjustDto * @param citJournalAdjustDto
* @return * @return
*/ */
public PageInfo<CitJournalAdjustDto> getJournalMergeData(CitJournalAdjustDto citJournalAdjustDto) { public PageInfo<CitJournalAdjustDto> getJournalMergeData(CitJournalAdjustDto citJournalAdjustDto) {
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust()); CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId()); List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId());
if(citJournalEntryAdjust.getPeriodEnd()!=null && citJournalEntryAdjust.getPeriodEnd()%100 ==12){ if (citJournalEntryAdjust.getPeriodEnd() != null && citJournalEntryAdjust.getPeriodEnd() % 100 == 12) {
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd()/100*100+13); citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd() / 100 * 100 + 13);
} }
Page page = PageHelper.startPage(citJournalAdjustDto.getPageInfo().getPageIndex(), citJournalAdjustDto.getPageInfo().getPageSize()); Page page = PageHelper.startPage(citJournalAdjustDto.getPageInfo().getPageIndex(), citJournalAdjustDto.getPageInfo().getPageSize());
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust,orgList); List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust, orgList);
List<CitJournalAdjustDto> journalAdjustDtos = Lists.newArrayList(); List<CitJournalAdjustDto> journalAdjustDtos = Lists.newArrayList();
journalMerges.forEach(journal -> { journalMerges.forEach(journal -> {
CitJournalAdjustDto citJournalDto = new CitJournalAdjustDto(); CitJournalAdjustDto citJournalDto = new CitJournalAdjustDto();
...@@ -79,7 +69,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -79,7 +69,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
journalAdjustDtos.add(citJournalDto); journalAdjustDtos.add(citJournalDto);
}); });
PageInfo<CitJournalAdjustDto> pageInfo =new PageInfo<>(journalAdjustDtos); PageInfo<CitJournalAdjustDto> pageInfo = new PageInfo<>(journalAdjustDtos);
pageInfo.setTotal(page.getTotal()); pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citJournalAdjustDto.getPageInfo().getPageIndex()); pageInfo.setPageNum(citJournalAdjustDto.getPageInfo().getPageIndex());
return pageInfo; return pageInfo;
...@@ -87,19 +77,20 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -87,19 +77,20 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 根据卡片主键获取隶属的机构及子机构,若本身就是子机构那么只获取本身 * 根据卡片主键获取隶属的机构及子机构,若本身就是子机构那么只获取本身
*
* @param projectId * @param projectId
* @return * @return
*/ */
public List<String> getOrgList(String projectId){ public List<String> getOrgList(String projectId) {
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId()); Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
List<String> orgList = new ArrayList<>(); List<String> orgList = new ArrayList<>();
orgList.add(project.getOrganizationId()); orgList.add(project.getOrganizationId());
if(StringUtils.isBlank(organization.getParentId())){ if (StringUtils.isBlank(organization.getParentId())) {
OrganizationExample organizationExample = new OrganizationExample(); OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andParentIdEqualTo(project.getOrganizationId()); organizationExample.createCriteria().andParentIdEqualTo(project.getOrganizationId());
List<Organization> organizations = organizationMapper.selectByExample(organizationExample); List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
for (Organization org:organizations) { for (Organization org : organizations) {
orgList.add(org.getId()); orgList.add(org.getId());
} }
} }
...@@ -108,6 +99,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -108,6 +99,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 日记账导出(第一种方式)--暂时不使用 * 日记账导出(第一种方式)--暂时不使用
*
* @param citJournalAdjustDto * @param citJournalAdjustDto
* @param os * @param os
* @return * @return
...@@ -134,23 +126,29 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -134,23 +126,29 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 日记账导出(第二种方式)--正在使用 * 日记账导出(第二种方式)--正在使用
*
* @param citJournalAdjustDto * @param citJournalAdjustDto
* @param response * @param response
* @return * @return
*/ */
public int exportJournalMergeData2(CitJournalAdjustDto citJournalAdjustDto, HttpServletResponse response){ public int exportJournalMergeData2(CitJournalAdjustDto citJournalAdjustDto, HttpServletResponse response) {
String fileName = citJournalAdjustDto.getPeriodStart() + "-" + citJournalAdjustDto.getPeriodEnd();
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setCharacterEncoding("UTF-8");
response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
response.addHeader("x-file-name", fileName);
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust()); CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId()); List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId());
if(citJournalEntryAdjust.getPeriodEnd()!=null && citJournalEntryAdjust.getPeriodEnd()%100 ==12){ if (citJournalEntryAdjust.getPeriodEnd() != null && citJournalEntryAdjust.getPeriodEnd() % 100 == 12) {
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd()/100*100+13); citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd() / 100 * 100 + 13);
} }
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust,orgList); List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust, orgList);
if(journalMerges.size()==0){ if (journalMerges.size() == 0) {
return 0; return 0;
} }
ExportDto exportDto = new ExportDto(); ExportDto exportDto = new ExportDto();
exportDto.setFileName("日记账"); exportDto.setFileName("日记账");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citJournalEntryAdjust.xlsx"); exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citJournalEntryAdjust.xlsx");
exportDto.setResponse(response); exportDto.setResponse(response);
exportDto.setList(journalMerges); exportDto.setList(journalMerges);
exportDto.setRelation(null); exportDto.setRelation(null);
...@@ -161,37 +159,39 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -161,37 +159,39 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 日记账导出(第一种方式)所用到的获取Excel表头 * 日记账导出(第一种方式)所用到的获取Excel表头
*
* @return * @return
*/ */
private Map<String, String> generalJMHeader() { private Map<String, String> generalJMHeader() {
Map<String, String> header = new LinkedHashMap<>(); Map<String, String> header = new LinkedHashMap<>();
header.put("ApprovalStatus","审批状态"); header.put("ApprovalStatus", "审批状态");
header.put("PostedStatus","过账"); header.put("PostedStatus", "过账");
header.put("AccountingPeriod","会计期间"); header.put("AccountingPeriod", "会计期间");
header.put("AccountingDate","凭证日期"); header.put("AccountingDate", "凭证日期");
header.put("JournalSource","日记账来源"); header.put("JournalSource", "日记账来源");
header.put("Category","日记账类别"); header.put("Category", "日记账类别");
header.put("Name","日记账名称"); header.put("Name", "日记账名称");
header.put("VoucherNum","凭证编号"); header.put("VoucherNum", "凭证编号");
header.put("Description","摘要"); header.put("Description", "摘要");
header.put("OrgCode","主体代码"); header.put("OrgCode", "主体代码");
header.put("SubjectCode","科目代码"); header.put("SubjectCode", "科目代码");
header.put("OrgName","主体代码"); header.put("OrgName", "主体代码");
header.put("SubjectName","科目代码"); header.put("SubjectName", "科目代码");
header.put("AccountedDr","借方金额"); header.put("AccountedDr", "借方金额");
header.put("AccountedCr","贷方金额"); header.put("AccountedCr", "贷方金额");
header.put("CreatedBy","创建人"); header.put("CreatedBy", "创建人");
header.put("CreatedDate","创建日期"); header.put("CreatedDate", "创建日期");
header.put("LateUpdatedBy","最后更新人"); header.put("LateUpdatedBy", "最后更新人");
header.put("LateUpdatedDate","最后更新日期"); header.put("LateUpdatedDate", "最后更新日期");
header.put("Period","税务系统期间"); header.put("Period", "税务系统期间");
return header; return header;
} }
/** /**
* 获取自动生成的试算平衡表数据 * 获取自动生成的试算平衡表数据
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @return * @return
*/ */
...@@ -200,11 +200,11 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -200,11 +200,11 @@ public class CitDataPreviewServiceImpl extends BaseService {
CitTrialBalanceExample citTbExample = new CitTrialBalanceExample(); CitTrialBalanceExample citTbExample = new CitTrialBalanceExample();
CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria(); CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria();
citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId()); citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){ if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
citTbExampleCriteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%"); citTbExampleCriteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
} }
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){ if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
citTbExampleCriteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%"); citTbExampleCriteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
} }
List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample); List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample);
...@@ -215,7 +215,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -215,7 +215,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
citTbDtos.add(citTrialBalanceDtoTemp); citTbDtos.add(citTrialBalanceDtoTemp);
}); });
PageInfo<CitTrialBalanceDto> pageInfo =new PageInfo<>(citTbDtos); PageInfo<CitTrialBalanceDto> pageInfo = new PageInfo<>(citTbDtos);
pageInfo.setTotal(page.getTotal()); pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex()); pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex());
return pageInfo; return pageInfo;
...@@ -223,6 +223,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -223,6 +223,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 试算平衡表生成版的导出(第一种方式) * 试算平衡表生成版的导出(第一种方式)
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @param os * @param os
* @return * @return
...@@ -251,27 +252,28 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -251,27 +252,28 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 试算平衡表生成版的导出(第二种导出方式) * 试算平衡表生成版的导出(第二种导出方式)
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @param response * @param response
* @return * @return
*/ */
public int exportTbGeneVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response){ public int exportTbGeneVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response) {
CitTrialBalanceExample citTbExample = new CitTrialBalanceExample(); CitTrialBalanceExample citTbExample = new CitTrialBalanceExample();
CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria(); CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria();
citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId()); citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){ if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
citTbExampleCriteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%"); citTbExampleCriteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
} }
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){ if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
citTbExampleCriteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%"); citTbExampleCriteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
} }
List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample); List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample);
if(citTbList.size()==0){ if (citTbList.size() == 0) {
return 0; return 0;
} }
ExportDto exportDto = new ExportDto(); ExportDto exportDto = new ExportDto();
exportDto.setFileName("试算平衡表生成版"); exportDto.setFileName("试算平衡表生成版");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceGene.xlsx"); exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceGene.xlsx");
exportDto.setResponse(response); exportDto.setResponse(response);
exportDto.setList(citTbList); exportDto.setList(citTbList);
exportDto.setRelation(null); exportDto.setRelation(null);
...@@ -282,23 +284,25 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -282,23 +284,25 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 试算平衡表生成版的导出(第一种方式)所用到的生成Excel的表头 * 试算平衡表生成版的导出(第一种方式)所用到的生成Excel的表头
*
* @return * @return
*/ */
private Map<String, String> generalTbGeneVerHeader() { private Map<String, String> generalTbGeneVerHeader() {
Map<String, String> header = new LinkedHashMap<>(); Map<String, String> header = new LinkedHashMap<>();
header.put("AccountCode","科目代码"); header.put("AccountCode", "科目代码");
header.put("AccountDescription","科目说明"); header.put("AccountDescription", "科目说明");
header.put("AccountingPeriod","期间"); header.put("AccountingPeriod", "期间");
header.put("DebitAmount","借方发生额"); header.put("DebitAmount", "借方发生额");
header.put("CreditAmount","贷方发生额"); header.put("CreditAmount", "贷方发生额");
header.put("BeginningBalance","期初余额"); header.put("BeginningBalance", "期初余额");
header.put("EndingBalance","期末余额"); header.put("EndingBalance", "期末余额");
return header; return header;
} }
/** /**
* 获取试算平衡表Mapping版的数据 * 获取试算平衡表Mapping版的数据
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @return * @return
*/ */
...@@ -307,14 +311,14 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -307,14 +311,14 @@ public class CitDataPreviewServiceImpl extends BaseService {
CitTbamExample citTbamExample = new CitTbamExample(); CitTbamExample citTbamExample = new CitTbamExample();
CitTbamExample.Criteria criteria = citTbamExample.createCriteria(); CitTbamExample.Criteria criteria = citTbamExample.createCriteria();
criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId()); criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){ if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
criteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%"); criteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
} }
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){ if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
criteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%"); criteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
} }
if(citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())){ if (citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())) {
criteria.andAttributeLike("%"+citTrialBalanceDto.getAttribute()+"%"); criteria.andAttributeLike("%" + citTrialBalanceDto.getAttribute() + "%");
} }
List<CitTrialBalanceDto> citTbList = Lists.newArrayList(); List<CitTrialBalanceDto> citTbList = Lists.newArrayList();
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample); List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
...@@ -325,8 +329,8 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -325,8 +329,8 @@ public class CitDataPreviewServiceImpl extends BaseService {
} }
// List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto); // List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto);
PageInfo<CitTrialBalanceDto> pageInfo =new PageInfo<>(citTbList); PageInfo<CitTrialBalanceDto> pageInfo = new PageInfo<>(citTbList);
pageInfo.setTotal(page.getTotal()); pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex()); pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex());
return pageInfo; return pageInfo;
...@@ -334,6 +338,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -334,6 +338,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 试算平衡表Mapping版的导出(第一种方式) * 试算平衡表Mapping版的导出(第一种方式)
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @param os * @param os
* @return * @return
...@@ -343,7 +348,7 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -343,7 +348,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto); List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto);
Map<String, String> header = generalTbGeneVerHeader(); Map<String, String> header = generalTbGeneVerHeader();
header.put("Attribute","小类"); header.put("Attribute", "小类");
List<CitTrialBalanceExportDto> cellList = new ArrayList<>(); List<CitTrialBalanceExportDto> cellList = new ArrayList<>();
citTbList.forEach(tb -> { citTbList.forEach(tb -> {
CitTrialBalanceExportDto d = new CitTrialBalanceExportDto(); CitTrialBalanceExportDto d = new CitTrialBalanceExportDto();
...@@ -360,22 +365,23 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -360,22 +365,23 @@ public class CitDataPreviewServiceImpl extends BaseService {
/** /**
* 试算平衡表Mapping版的导出(第二种导出方式) * 试算平衡表Mapping版的导出(第二种导出方式)
*
* @param citTrialBalanceDto * @param citTrialBalanceDto
* @param response * @param response
* @return * @return
*/ */
public int exportTbMappingVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response){ public int exportTbMappingVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response) {
CitTbamExample citTbamExample = new CitTbamExample(); CitTbamExample citTbamExample = new CitTbamExample();
CitTbamExample.Criteria criteria = citTbamExample.createCriteria(); CitTbamExample.Criteria criteria = citTbamExample.createCriteria();
criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId()); criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){ if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
criteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%"); criteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
} }
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){ if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
criteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%"); criteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
} }
if(citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())){ if (citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())) {
criteria.andAttributeLike("%"+citTrialBalanceDto.getAttribute()+"%"); criteria.andAttributeLike("%" + citTrialBalanceDto.getAttribute() + "%");
} }
List<CitTrialBalanceDto> citTbList = Lists.newArrayList(); List<CitTrialBalanceDto> citTbList = Lists.newArrayList();
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample); List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
...@@ -384,12 +390,12 @@ public class CitDataPreviewServiceImpl extends BaseService { ...@@ -384,12 +390,12 @@ public class CitDataPreviewServiceImpl extends BaseService {
beanUtil.copyProperties(citTbam, citTrialBalanceDtoTemp); beanUtil.copyProperties(citTbam, citTrialBalanceDtoTemp);
citTbList.add(citTrialBalanceDtoTemp); citTbList.add(citTrialBalanceDtoTemp);
} }
if(citTbList.size()==0){ if (citTbList.size() == 0) {
return 0; return 0;
} }
ExportDto exportDto = new ExportDto(); ExportDto exportDto = new ExportDto();
exportDto.setFileName("试算平衡表Mapping版"); exportDto.setFileName("试算平衡表Mapping版");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceMapping.xlsx"); exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceMapping.xlsx");
exportDto.setResponse(response); exportDto.setResponse(response);
exportDto.setList(citTbList); exportDto.setList(citTbList);
exportDto.setRelation(citTbList.get(0)); exportDto.setRelation(citTbList.get(0));
......
...@@ -185,6 +185,7 @@ ...@@ -185,6 +185,7 @@
withCredentials: true withCredentials: true
}).then(function(resp) { }).then(function(resp) {
var ret = resp.data; var ret = resp.data;
$scope.fileName='';
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (ret.result) { if (ret.result) {
......
...@@ -171,6 +171,7 @@ ...@@ -171,6 +171,7 @@
__RequestVerificationToken: token, __RequestVerificationToken: token,
withCredentials: true withCredentials: true
}).then(function(data) { }).then(function(data) {
$scope.fileName='';
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
var resp = data.data; var resp = data.data;
deferred.resolve(); deferred.resolve();
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
if (noExtendFileName) { if (noExtendFileName) {
filename = defaultFileName+ "_" +vatSessionService.project.name+'.xls' filename = defaultFileName+ "_" +vatSessionService.project.name+'.xls'
} else { } else {
filename = defaultFileName+"_"+decodeURI(headers['x-file-name']+ "_" +vatSessionService.project.name+'.xls') filename = defaultFileName+"_"+decodeURI(headers['x-file-name']).replace('???','').replace(',','')+ "_" +vatSessionService.project.name+'.xls'
} }
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
thisConfig.responseType = "arraybuffer"; thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCFData/get', queryParm, thisConfig).then(function (response) { return $http.post('/dataPreview/exportCFData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+queryParm.periodStart+'-'+vatSessionService.year+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx'); FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
}); });
}, },
getPLDataForDisplay: function (queryParams) { getPLDataForDisplay: function (queryParams) {
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
thisConfig.responseType = "arraybuffer"; thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportIRData/get', queryParm, thisConfig).then(function (response) { return $http.post('/dataPreview/exportIRData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+queryParm.periodStart+'-'+vatSessionService.year+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx'); FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+(queryParm.periodStart<10?'0'+queryParm.periodStart:queryParm.periodStart)+'-'+vatSessionService.year+(queryParm.periodEnd<10?'0'+queryParm.periodEnd:queryParm.periodEnd)+'_'+vatSessionService.project.name+'.xlsx');
}); });
}, },
getCPRDataForDisplay: function (queryParams) { getCPRDataForDisplay: function (queryParams) {
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
thisConfig.responseType = "arraybuffer"; thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCPRData/get', queryParm, thisConfig).then(function (response) { return $http.post('/dataPreview/exportCPRData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+queryParm.periodStart+'-'+vatSessionService.year+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx'); FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
}); });
}, },
getRLITDataForDisplay: function (queryParams) { getRLITDataForDisplay: function (queryParams) {
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
thisConfig.responseType = "arraybuffer"; thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportRLITData/get', queryParm, thisConfig).then(function (response) { return $http.post('/dataPreview/exportRLITData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+queryParm.periodStart+'-'+vatSessionService.year+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx'); FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
}); });
}, },
getCILDataForDisplay: function (queryParams) { getCILDataForDisplay: function (queryParams) {
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
thisConfig.responseType = "arraybuffer"; thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportIDData/get', queryParm, thisConfig).then(function (response) { return $http.post('/dataPreview/exportIDData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data,fileName + '_'+vatSessionService.year+queryParm.periodStart+'-'+vatSessionService.year+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx'); FileSaver.saveAs(data,fileName + '_'+queryParm.periodStart+'-'+queryParm.periodEnd+'_'+vatSessionService.project.name+'.xlsx');
}); });
} }
}; };
......
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