Commit 76f36f33 authored by eddie.woo's avatar eddie.woo

Merge remote-tracking branch 'origin/dev_mysql' into uat_didi

parents eb2d9409 624c28bc
......@@ -179,4 +179,5 @@ public final class Constant {
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
/**
* CIT数据预览功能模块Controller
*
* @author zhikai.z.wei
*/
@RestController
......@@ -34,6 +35,7 @@ public class CitDataPreviewController extends BaseController {
/**
* 日记账合并版数据的获取
*
* @param citJournalAdjustDto
* @return
*/
......@@ -45,12 +47,15 @@ public class CitDataPreviewController extends BaseController {
/**
* 日记账合并版导出
*
* @param paras
* @param response
*/
@RequestMapping(value = "exportJournalMergeData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportJournalMergeData(@RequestBody CitJournalAdjustDto paras, HttpServletResponse response) {
int count = citDataPreviewService.exportJournalMergeData2(paras, response);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
......@@ -61,6 +66,7 @@ public class CitDataPreviewController extends BaseController {
/**
* 试算平衡表生成版的数据获取
*
* @param citTrialBalanceDto
* @return
*/
......@@ -72,6 +78,7 @@ public class CitDataPreviewController extends BaseController {
/**
* 试算平衡表生成版的导出
*
* @param paras
* @param response
*/
......@@ -108,6 +115,7 @@ public class CitDataPreviewController extends BaseController {
/**
* 试算平衡表Mapping版的数据获取
*
* @param citTrialBalanceDto
* @return
*/
......@@ -120,6 +128,7 @@ public class CitDataPreviewController extends BaseController {
/**
* 试算平衡表Mapping版的导出
*
* @param paras
* @param response
*/
......
......@@ -25,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Optional;
......@@ -251,6 +252,34 @@ public class CitReportController {
return ResponseEntity.ok(reportService.addCellManualDataSource(data, from));
}
@RequestMapping(value = "exportReportData/{projectId}/{period}", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public void exportReportData(HttpServletResponse response, @RequestBody PeriodReportDataParam param,
@PathVariable(name = "period", required = false) Integer period,
@PathVariable(name = "projectId", required = false) String projectId) {
OutputStream ouputStream = null;
try {
Workbook tWorkbook = citReportService.generateReportData(param.getReportIds(), projectId, period);
response.setContentType("multipart/form-data");
// response.setHeader("Content-Disposition", "attachment;fileName=" + new String(param.getFileName().getBytes("GB2312"), "ISO-8859-1"));
ouputStream = response.getOutputStream();
tWorkbook.write(ouputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (ouputStream != null) {
ouputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@RequestMapping(value = "uploadReportData/{projectId}/{period}", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
......
......@@ -203,12 +203,19 @@ public class AnalysisJobServiceImpl extends BaseService {
String regionMeg = regionMap.get(o.getRegionId());
List<String> regionMs = Lists.newArrayList();
if (StringUtils.isNotEmpty(regionMeg)) {
regionMs = Arrays.asList(regionMeg.split("."));
regionMs = Arrays.asList(regionMeg.split(","));
}
if (!regionMs.isEmpty()) {
am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : "");
am.setCity(regionMs.get(2) != null ? regionMs.get(2) : "");
am.setDistrict(regionMs.get(3) != null ? regionMs.get(4) : "");
if(regionMs.size() == 4){
am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : "");
am.setCity(regionMs.get(2) != null ? regionMs.get(2) : "");
am.setDistrict(regionMs.get(3) != null ? regionMs.get(3) : "");
}else if(regionMs.size() == 3){
am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : "");
am.setCity(regionMs.get(2) != null ? regionMs.get(2) : "");
}else if(regionMs.size() == 2){
am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : "");
}
}
am.setBusinessLine(buMap.get(o.getBusinessUnitId()));
am.setCode(o.getCode());
......@@ -223,7 +230,8 @@ public class AnalysisJobServiceImpl extends BaseService {
}
analysisMasterMapper.insertSelective(am);
} catch (Exception e) {
logger.error(String.format("公司:[%s]生成机构分析数据失败!", o.getName()), e);
e.printStackTrace();
logger.error(String.format("生成机构分析数据失败!", e.getMessage()));
}
}
......
......@@ -932,7 +932,7 @@ public class AnalysisServiceImpl extends BaseService {
.andCompanyNameEqualTo(getCellValue(sheetAt.getRow(i).getCell(3), false).toString())
.andPeriodEqualTo(period);
List<AnalysisMaster> analysisMasters = analysisMasterMapper.selectByExample(example);
if (breakFlag > 3) {
if (breakFlag > 20) {
logger.info("大于三条数据不匹配,直接停止进程");
break;
}
......@@ -962,8 +962,14 @@ public class AnalysisServiceImpl extends BaseService {
salesList.add(sales);
}
}
int salesInt = analysisSalesMapper.insertBatch(salesList);
int taxInt = analysisTaxMapper.insertBatch(taxList);
int salesInt = 0;
if (salesList.size() != 0) {
salesInt = analysisSalesMapper.insertBatch(salesList);
}
int taxInt = 0;
if (taxList.size() != 0) {
taxInt = analysisTaxMapper.insertBatch(taxList);
}
logger.info("analysis_salesInt 更新数据条数" + salesInt);
logger.info("analysis_tax 更新数据条数" + taxInt);
System.out.println("数据初始化消耗: " + (System.currentTimeMillis() - now));
......
......@@ -6,34 +6,22 @@ import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.JxlsUtils;
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.dto.CitJournalAdjustDto;
import pwc.taxtech.atms.dpo.CitTrialBalanceDto;
import pwc.taxtech.atms.dto.CitJournalAdjustDto;
import pwc.taxtech.atms.dto.CitTrialBalanceExportDto;
import pwc.taxtech.atms.dto.JournalMergeExportDto;
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.exception.ServiceException;
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.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -41,6 +29,7 @@ import java.util.Map;
/**
* CIT数据预览功能模块
*
* @author zhikai.z.wei
* @Date: 02/03/2019
* @Description:
......@@ -61,17 +50,18 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 获取日记账合并版
*
* @param citJournalAdjustDto
* @return
*/
public PageInfo<CitJournalAdjustDto> getJournalMergeData(CitJournalAdjustDto citJournalAdjustDto) {
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId());
if(citJournalEntryAdjust.getPeriodEnd()!=null && citJournalEntryAdjust.getPeriodEnd()%100 ==12){
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd()/100*100+13);
if (citJournalEntryAdjust.getPeriodEnd() != null && citJournalEntryAdjust.getPeriodEnd() % 100 == 12) {
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd() / 100 * 100 + 13);
}
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();
journalMerges.forEach(journal -> {
CitJournalAdjustDto citJournalDto = new CitJournalAdjustDto();
......@@ -79,7 +69,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
journalAdjustDtos.add(citJournalDto);
});
PageInfo<CitJournalAdjustDto> pageInfo =new PageInfo<>(journalAdjustDtos);
PageInfo<CitJournalAdjustDto> pageInfo = new PageInfo<>(journalAdjustDtos);
pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citJournalAdjustDto.getPageInfo().getPageIndex());
return pageInfo;
......@@ -87,19 +77,20 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 根据卡片主键获取隶属的机构及子机构,若本身就是子机构那么只获取本身
*
* @param projectId
* @return
*/
public List<String> getOrgList(String projectId){
public List<String> getOrgList(String projectId) {
Project project = projectMapper.selectByPrimaryKey(projectId);
Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
List<String> orgList = new ArrayList<>();
orgList.add(project.getOrganizationId());
if(StringUtils.isBlank(organization.getParentId())){
if (StringUtils.isBlank(organization.getParentId())) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andParentIdEqualTo(project.getOrganizationId());
List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
for (Organization org:organizations) {
for (Organization org : organizations) {
orgList.add(org.getId());
}
}
......@@ -108,6 +99,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 日记账导出(第一种方式)--暂时不使用
*
* @param citJournalAdjustDto
* @param os
* @return
......@@ -134,23 +126,29 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 日记账导出(第二种方式)--正在使用
*
* @param citJournalAdjustDto
* @param response
* @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());
List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId());
if(citJournalEntryAdjust.getPeriodEnd()!=null && citJournalEntryAdjust.getPeriodEnd()%100 ==12){
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd()/100*100+13);
if (citJournalEntryAdjust.getPeriodEnd() != null && citJournalEntryAdjust.getPeriodEnd() % 100 == 12) {
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd() / 100 * 100 + 13);
}
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust,orgList);
if(journalMerges.size()==0){
return 0;
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMergeByOrgList(citJournalEntryAdjust, orgList);
if (journalMerges.size() == 0) {
return 0;
}
ExportDto exportDto = new ExportDto();
exportDto.setFileName("日记账");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citJournalEntryAdjust.xlsx");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citJournalEntryAdjust.xlsx");
exportDto.setResponse(response);
exportDto.setList(journalMerges);
exportDto.setRelation(null);
......@@ -161,37 +159,39 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 日记账导出(第一种方式)所用到的获取Excel表头
*
* @return
*/
private Map<String, String> generalJMHeader() {
Map<String, String> header = new LinkedHashMap<>();
header.put("ApprovalStatus","审批状态");
header.put("PostedStatus","过账");
header.put("ApprovalStatus", "审批状态");
header.put("PostedStatus", "过账");
header.put("AccountingPeriod","会计期间");
header.put("AccountingDate","凭证日期");
header.put("JournalSource","日记账来源");
header.put("Category","日记账类别");
header.put("Name","日记账名称");
header.put("VoucherNum","凭证编号");
header.put("Description","摘要");
header.put("OrgCode","主体代码");
header.put("SubjectCode","科目代码");
header.put("OrgName","主体代码");
header.put("SubjectName","科目代码");
header.put("AccountingPeriod", "会计期间");
header.put("AccountingDate", "凭证日期");
header.put("JournalSource", "日记账来源");
header.put("Category", "日记账类别");
header.put("Name", "日记账名称");
header.put("VoucherNum", "凭证编号");
header.put("Description", "摘要");
header.put("OrgCode", "主体代码");
header.put("SubjectCode", "科目代码");
header.put("OrgName", "主体代码");
header.put("SubjectName", "科目代码");
header.put("AccountedDr","借方金额");
header.put("AccountedCr","贷方金额");
header.put("CreatedBy","创建人");
header.put("CreatedDate","创建日期");
header.put("LateUpdatedBy","最后更新人");
header.put("LateUpdatedDate","最后更新日期");
header.put("Period","税务系统期间");
header.put("AccountedDr", "借方金额");
header.put("AccountedCr", "贷方金额");
header.put("CreatedBy", "创建人");
header.put("CreatedDate", "创建日期");
header.put("LateUpdatedBy", "最后更新人");
header.put("LateUpdatedDate", "最后更新日期");
header.put("Period", "税务系统期间");
return header;
}
/**
* 获取自动生成的试算平衡表数据
*
* @param citTrialBalanceDto
* @return
*/
......@@ -200,11 +200,11 @@ public class CitDataPreviewServiceImpl extends BaseService {
CitTrialBalanceExample citTbExample = new CitTrialBalanceExample();
CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria();
citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){
citTbExampleCriteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%");
if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
citTbExampleCriteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
}
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){
citTbExampleCriteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%");
if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
citTbExampleCriteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
}
List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample);
......@@ -215,7 +215,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
citTbDtos.add(citTrialBalanceDtoTemp);
});
PageInfo<CitTrialBalanceDto> pageInfo =new PageInfo<>(citTbDtos);
PageInfo<CitTrialBalanceDto> pageInfo = new PageInfo<>(citTbDtos);
pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex());
return pageInfo;
......@@ -223,6 +223,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 试算平衡表生成版的导出(第一种方式)
*
* @param citTrialBalanceDto
* @param os
* @return
......@@ -251,27 +252,28 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 试算平衡表生成版的导出(第二种导出方式)
*
* @param citTrialBalanceDto
* @param response
* @return
*/
public int exportTbGeneVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response){
public int exportTbGeneVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response) {
CitTrialBalanceExample citTbExample = new CitTrialBalanceExample();
CitTrialBalanceExample.Criteria citTbExampleCriteria = citTbExample.createCriteria();
citTbExampleCriteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){
citTbExampleCriteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%");
if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
citTbExampleCriteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
}
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){
citTbExampleCriteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%");
if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
citTbExampleCriteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
}
List<CitTrialBalance> citTbList = citTbMapper.selectByExample(citTbExample);
if(citTbList.size()==0){
return 0;
if (citTbList.size() == 0) {
return 0;
}
ExportDto exportDto = new ExportDto();
exportDto.setFileName("试算平衡表生成版");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceGene.xlsx");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceGene.xlsx");
exportDto.setResponse(response);
exportDto.setList(citTbList);
exportDto.setRelation(null);
......@@ -282,23 +284,25 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 试算平衡表生成版的导出(第一种方式)所用到的生成Excel的表头
*
* @return
*/
private Map<String, String> generalTbGeneVerHeader() {
Map<String, String> header = new LinkedHashMap<>();
header.put("AccountCode","科目代码");
header.put("AccountDescription","科目说明");
header.put("AccountCode", "科目代码");
header.put("AccountDescription", "科目说明");
header.put("AccountingPeriod","期间");
header.put("DebitAmount","借方发生额");
header.put("CreditAmount","贷方发生额");
header.put("BeginningBalance","期初余额");
header.put("EndingBalance","期末余额");
header.put("AccountingPeriod", "期间");
header.put("DebitAmount", "借方发生额");
header.put("CreditAmount", "贷方发生额");
header.put("BeginningBalance", "期初余额");
header.put("EndingBalance", "期末余额");
return header;
}
/**
* 获取试算平衡表Mapping版的数据
*
* @param citTrialBalanceDto
* @return
*/
......@@ -307,14 +311,14 @@ public class CitDataPreviewServiceImpl extends BaseService {
CitTbamExample citTbamExample = new CitTbamExample();
CitTbamExample.Criteria criteria = citTbamExample.createCriteria();
criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){
criteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%");
if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
criteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
}
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){
criteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%");
if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
criteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
}
if(citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())){
criteria.andAttributeLike("%"+citTrialBalanceDto.getAttribute()+"%");
if (citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())) {
criteria.andAttributeLike("%" + citTrialBalanceDto.getAttribute() + "%");
}
List<CitTrialBalanceDto> citTbList = Lists.newArrayList();
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
......@@ -325,8 +329,8 @@ public class CitDataPreviewServiceImpl extends BaseService {
}
// List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto);
PageInfo<CitTrialBalanceDto> pageInfo =new PageInfo<>(citTbList);
PageInfo<CitTrialBalanceDto> pageInfo = new PageInfo<>(citTbList);
pageInfo.setTotal(page.getTotal());
pageInfo.setPageNum(citTrialBalanceDto.getPageInfo().getPageIndex());
return pageInfo;
......@@ -334,6 +338,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 试算平衡表Mapping版的导出(第一种方式)
*
* @param citTrialBalanceDto
* @param os
* @return
......@@ -343,7 +348,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
List<CitTrialBalanceDto> citTbList = citTbMapper.getTbMappingData(citTrialBalanceDto);
Map<String, String> header = generalTbGeneVerHeader();
header.put("Attribute","小类");
header.put("Attribute", "小类");
List<CitTrialBalanceExportDto> cellList = new ArrayList<>();
citTbList.forEach(tb -> {
CitTrialBalanceExportDto d = new CitTrialBalanceExportDto();
......@@ -360,22 +365,23 @@ public class CitDataPreviewServiceImpl extends BaseService {
/**
* 试算平衡表Mapping版的导出(第二种导出方式)
*
* @param citTrialBalanceDto
* @param response
* @return
*/
public int exportTbMappingVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response){
public int exportTbMappingVerData2(CitTrialBalanceDto citTrialBalanceDto, HttpServletResponse response) {
CitTbamExample citTbamExample = new CitTbamExample();
CitTbamExample.Criteria criteria = citTbamExample.createCriteria();
criteria.andProjectIdEqualTo(citTrialBalanceDto.getProjectId());
if(citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())){
criteria.andAccountCodeLike("%"+citTrialBalanceDto.getAccountCode()+"%");
if (citTrialBalanceDto.getAccountCode() != null && !"".equals(citTrialBalanceDto.getAccountCode())) {
criteria.andAccountCodeLike("%" + citTrialBalanceDto.getAccountCode() + "%");
}
if(citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())){
criteria.andAccountDescriptionLike("%"+citTrialBalanceDto.getAccountDescription()+"%");
if (citTrialBalanceDto.getAccountDescription() != null && !"".equals(citTrialBalanceDto.getAccountDescription())) {
criteria.andAccountDescriptionLike("%" + citTrialBalanceDto.getAccountDescription() + "%");
}
if(citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())){
criteria.andAttributeLike("%"+citTrialBalanceDto.getAttribute()+"%");
if (citTrialBalanceDto.getAttribute() != null && !"".equals(citTrialBalanceDto.getAttribute())) {
criteria.andAttributeLike("%" + citTrialBalanceDto.getAttribute() + "%");
}
List<CitTrialBalanceDto> citTbList = Lists.newArrayList();
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
......@@ -384,12 +390,12 @@ public class CitDataPreviewServiceImpl extends BaseService {
beanUtil.copyProperties(citTbam, citTrialBalanceDtoTemp);
citTbList.add(citTrialBalanceDtoTemp);
}
if(citTbList.size()==0){
return 0;
if (citTbList.size() == 0) {
return 0;
}
ExportDto exportDto = new ExportDto();
exportDto.setFileName("试算平衡表Mapping版");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceMapping.xlsx");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citTrialBalanceMapping.xlsx");
exportDto.setResponse(response);
exportDto.setList(citTbList);
exportDto.setRelation(citTbList.get(0));
......
......@@ -1047,7 +1047,7 @@ public class DataImportService extends BaseService {
}
if (validateRes && EnumTbImportType.CoverImport.getCode().equals(importType)) {
RedLetterInfoTableExample redLetterInfoTableExample = new RedLetterInfoTableExample();
redLetterInfoTableExample.createCriteria().andSubjectNumEqualTo(companyCode).andFillInDateEqualTo(rlits.get(0).getFillInDate());
redLetterInfoTableExample.createCriteria().andSubjectNumEqualTo(companyCode).andPeriodEqualTo(rlits.get(0).getPeriod());
redLetterInfoTableMapper.deleteByExample(redLetterInfoTableExample);
}
redLetterInfoTableMapper.insertBatch(rlits);
......
......@@ -1332,62 +1332,76 @@ public class ReportServiceImpl extends BaseService {
ebit = new EbitCellData();
switch (profitLossStatement.getItemName().trim()) {
case "一、营业收入":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(11);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "减:营业成本":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(12);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "营业税金及附加":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(13);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "销售费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(14);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "管理费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(15);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "研发费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(16);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "财务费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(17);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "资产减值损失":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(18);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break;
case "加:公允价值变动收益(损失以“-”号填列)":
ebit.setRow(19);
break;
case "投资收益(损失以“-”号填列)":
ebit.setRow(20);
break;
case "其他收益":
ebit.setRow(21);
break;
case "资产处置收益(损失以“-”号填列)":
ebit.setRow(22);
break;
case "二、营业利润(亏损以“-”号填列)":
ebit.setRow(23);
break;
case "加:营业外收入":
ebit.setRow(24);
break;
case "减:营业外支出":
ebit.setRow(25);
break;
case "三、利润总额(亏损总额以“-”号填列)":
ebit.setRow(27);
break;
case "减:所得税费用":
ebit.setRow(28);
break;
case "四、净利润(净亏损以“-”号填列)":
ebit.setRow(29);
break;
case "少数股东损益":
ebit.setRow(30);
break;
case "五、每股收益:":
ebit.setRow(31);
break;
case "(一)基本每股收益":
ebit.setRow(32);
break;
case "(二)稀释每股收益":
ebit.setRow(33);
break;
}
///ebit.setCol(2);
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
list1.add(ebit);
}
return list1;
......@@ -1700,27 +1714,28 @@ public class ReportServiceImpl extends BaseService {
BigDecimal yffy = new BigDecimal(0);//研发费用
BigDecimal zcjzss = new BigDecimal(0); //资产减值损失
for (CellDataDto cellDataDto : cellDataDtoList) {
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 11) { //一、营业收入
yysr = new BigDecimal(cellDataDto.getCellValue());
continue;
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 12) {//减:营业成本
yycb = new BigDecimal(cellDataDto.getCellValue());
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 13) {//营业税金及附加
yysjfj = new BigDecimal(cellDataDto.getCellValue());
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 14) {//销售费用
xsfy = new BigDecimal(cellDataDto.getCellValue());
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 15) {//管理费用
glfy = new BigDecimal(cellDataDto.getCellValue());
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 16) {//研发费用
yffy = new BigDecimal(cellDataDto.getCellValue());
}
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 18) {//资产减值损失
zcjzss = new BigDecimal(cellDataDto.getCellValue());
switch (cellDataDto.getColumnIndex() + ":" + cellDataDto.getRowIndex()) {
case "2:11":
yysr = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:12":
yycb = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:13":
yysjfj = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:14":
xsfy = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:15":
glfy = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:16":
yffy = new BigDecimal(cellDataDto.getCellValue());
break;
case "2:18":
zcjzss = new BigDecimal(cellDataDto.getCellValue());
break;
}
}
BigDecimal subtract = yysr.subtract(yycb).add(yysjfj).add(xsfy).add(glfy).add(yffy).add(zcjzss);
......@@ -1778,6 +1793,7 @@ public class ReportServiceImpl extends BaseService {
return ebitDataDto;
}
public EbitDataDto calculateEbitDataByEbit(List<EbitCellData> ebitCellData, String specialConsiderations, String ebitRate) {
EbitDataDto ebitDataDto = new EbitDataDto();
try {
......@@ -1803,6 +1819,8 @@ public class ReportServiceImpl extends BaseService {
BigDecimal yffy = new BigDecimal(0);//研发费用
BigDecimal zcjzss = new BigDecimal(0); //资产减值损失
for (EbitCellData ebitCellData1 : ebitCellData) {
if (ebitCellData1.getRow() == null)
continue;
if (ebitCellData1.getCol() == 2 && ebitCellData1.getRow() == 11) { //一、营业收入
if (StringUtils.isNotEmpty(ebitCellData1.getData())) yysr = new BigDecimal(ebitCellData1.getData());
continue;
......@@ -2705,9 +2723,9 @@ public class ReportServiceImpl extends BaseService {
Map<String, List<ProfitLossStatementPrc>> newMap = new HashMap<>();
///如果ebitCellData 中已经存在当前机构的数,将取 ebit中,否则取利润表中
if(collect1.isEmpty()){
if (collect1.isEmpty()) {
newMap = collect2;
}else{
} else {
for (Map.Entry<String, List<EbitCellData>> entry1 : collect1.entrySet()) {
for (Map.Entry<String, List<ProfitLossStatementPrc>> entry2 : collect2.entrySet()) {
/*System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());*/
......@@ -2729,7 +2747,6 @@ public class ReportServiceImpl extends BaseService {
sheetAt = workbook1.getSheetAt(0);
List<Integer> cols = Lists.newArrayList();
FileExcelUtil.deleteColumn(sheetAt, 1, cols);
List<String> ebitTitle = Lists.newArrayList("EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额");
//设置单元格居右
cellStyle1 = workbook1.createCellStyle();//创建样式
......@@ -2754,10 +2771,19 @@ public class ReportServiceImpl extends BaseService {
ebitCellDataList.add(ebitDataDto);
}
} else {
ebitCellDataList.add(calculateEbitDataByEbit(entry.getValue(), specialConsideration, ebitRate));
List<EbitCellData> list = entry.getValue();
EbitDataDto ebitDataDto = new EbitDataDto();
ebitDataDto.setEbitSubtraction(BigDecimal.ZERO);
ebitDataDto.setSpecialFactors(BigDecimal.ZERO);
ebitDataDto.setTransactionAmount(BigDecimal.ZERO);
ebitDataDto.setSixAddTax(BigDecimal.ZERO);
ebitDataDto.setTotalAmountTax(BigDecimal.ZERO);
ebitDataDto.setEbitRate("1%");
ebitDataDto.setSpecialConsiderations("0");
ebitCellDataList.add(ebitDataDto);
}
//加载计算ebit数据
//加载计算ebit数据
for (int m = 0; m <= sheetAt.getLastRowNum(); m++) {
switch (m) {
case 7:
......@@ -2783,6 +2809,8 @@ public class ReportServiceImpl extends BaseService {
break;
if (sheetAt.getRow(m) != null && sheetAt.getRow(m).getCell(_index + 1) != null) {
for (EbitCellData ebitCellData : entry.getValue()) {
if (ebitCellData.getRow() == null)
continue;
if (m == ebitCellData.getRow()) {
try {
sheetAt.getRow(m).getCell(_index + 1).setCellValue(ebitCellData.getData().equals("") == true ? "0" : ebitCellData.getData());
......@@ -2795,77 +2823,45 @@ public class ReportServiceImpl extends BaseService {
//cell.setCellType(cellStyle.getAlignment());
}
if (m >= 37) {//加载ebit数据
for (EbitDataDto ebitCellData : ebitCellDataList) {
for (int i = 0; i < ebitCellDataList.size(); i++) {
switch (m) {
case 37:
addFormula(cellAndOrCreate(m, _index + 1,
ebitCellData.getEbitSubtraction().toString(),
sheetAt), Lists.newArrayList("12- ", "13- ", "14- ", "15- ", "16- ", "18"), _index + 1);
ebitCellDataList.get(_index).getEbitSubtraction().toString(),
sheetAt), Lists.newArrayList("12- ", "13- ", "14- ", "15- ", "16- ", "17-", "19"), _index + 1);
break;
case 38:
cellAndOrCreate(m, _index + 1, ebitCellData.getSpecialConsiderations(), sheetAt);
cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getSpecialConsiderations(), sheetAt);
break;
case 39:
addFormula(cellAndOrCreate(m, _index + 1, ebitCellData.getSpecialFactors().toString(), sheetAt),
addFormula(cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getSpecialFactors().toString(), sheetAt),
Lists.newArrayList("38+ ", "39"), _index + 1);
break;
case 40:
cellAndOrCreate(m, _index + 1, ebitCellData.getEbitRate(), sheetAt);
cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getEbitRate(), sheetAt);
break;
case 41:
addFormula(cellAndOrCreate(m, _index + 1, ebitCellData.getTransactionAmount().toString(), sheetAt),
addFormula(cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getTransactionAmount().toString(), sheetAt),
Lists.newArrayList("40 * ", "41"), _index + 1);
break;
case 42:
addFormula(cellAndOrCreate(m, _index + 1, ebitCellData.getSixAddTax().toString(), sheetAt), Lists.newArrayList("42 * 0.06"), _index + 1);
addFormula(cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getSixAddTax().toString(), sheetAt),
Lists.newArrayList("42 * 0.06"), _index + 1);
break;
case 43:
addFormula(cellAndOrCreate(m, _index + 1, ebitCellData.getTotalAmountTax().toString(), sheetAt), Lists.newArrayList("42 * 1.06"), _index + 1);
addFormula(cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getTotalAmountTax().toString(), sheetAt),
Lists.newArrayList("42 * 1.06"), _index + 1);
break;
}
break;
}
}
}
_index++;
}
sheetAt.setForceFormulaRecalculation(true);//强制执行公式
///合并单元格
insertExcelOne(headerCellType, workbook1, sheetAt, _index, requestParameterDto);
/* for (int i = 0; i < ebitSpreadData.size(); i++) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(ebitSpreadData.get(i).getFileKey()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
String path = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
path = uploadDetail.getList().get(0).getViewHttpUrl();
}
InputStream inputStream = httpFileService.getUserTemplate(path);
}*/
/* if (sheetAt == null) {
String filePath;
File templateFile;
Template template = templateService.getTemplateById(Long.parseLong(requestParameterDto.getTemplateId()));
String templatePath = templateService.getTemplatePath(Long.parseLong(requestParameterDto.getTemplateId()));
MyAsserts.assertNotEmpty(templatePath, new NotFoundException());
filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templateFile = new File(tempPath + templatePath);
InputStream inputStream = null;
//如果是系统报表就取本地文件夹,如果不是就取FTP
if (template.getIsSystemType()) {
inputStream = new BufferedInputStream(new FileInputStream(templateFile));
} else {
inputStream = httpFileService.getUserTemplate(templatePath);
}
workbook1 = new XSSFWorkbook(inputStream);
sheetAt = workbook1.getSheetAt(0);
List<Integer> cols = Lists.newArrayList();
FileExcelUtil.deleteColumn(sheetAt, 1, cols);
}*/
//加载所有当前期间所有利润的数据
/* insertData(requestParameterDto.getTemplateId(), requestParameterDto.getPeriod(), sheetAt, index);*/
//insertExcelOne(sheetAt, ebitSpreadData, workbook1, requestParameterDto.getPeriod());
FileExcelUtil.setExcelHeadInfo(response, request, requestParameterDto.getPeriod() + "-汇总利润表.xlsx");
FileExcelUtil.downloadExcel(request, response, requestParameterDto.getPeriod() + "-汇总利润表.xlsx", workbook1);
}
......@@ -2887,66 +2883,7 @@ public class ReportServiceImpl extends BaseService {
sheetAt.getRow(row).getCell(col).setCellStyle(cellStyle1);
return sheetAt.getRow(row).getCell(col);
}
/* public void insertData(String templateId, Integer period, Sheet sheet, int beginCell) {
List<Project> projects = projectMapper.selectByExample(example1);
for (EbitCell project : ebitCellData) {
String projectId = getProjId(project.getOrganizationId(), period);
List<CellDataDto> list = getCellData(getReportByTemplateEbit(Long.parseLong(templateId), period % 100, projectId).getData().getId(), projectId).getData().getCellData();
if (list.size() == 0)
return;
EbitDataDto ebitDataDto = calculateEbitData(list, specialConsideration, ebitRate);
for (CellDataDto cellDataDto : list) {
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() > 10)
sheet.getRow(cellDataDto.getRowIndex()).getCell(beginCell).setCellValue(cellDataDto.getCellValue());
}
for (int i = 37; i < 43; i++) {
if (i == 37) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getEbitSubtraction().toString());
sheet.getRow(i).getCell(beginCell).setCellFormula(LetterExcelUtil.NumToExcel(beginCell) + "11 - " +
LetterExcelUtil.NumToExcel(beginCell) + "12 -" +
LetterExcelUtil.NumToExcel(beginCell) + "13 -" +
LetterExcelUtil.NumToExcel(beginCell) + "14 -" +
LetterExcelUtil.NumToExcel(beginCell) + "15 -" +
LetterExcelUtil.NumToExcel(beginCell) + "16 -" +
LetterExcelUtil.NumToExcel(beginCell) + "18");
continue;
}
if (i == 38) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getSpecialConsiderations());
continue;
}
if (i == 39) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getEbitRate());
sheet.getRow(i).getCell(beginCell).setCellFormula(LetterExcelUtil.NumToExcel(beginCell) + "37 + " + LetterExcelUtil.NumToExcel(beginCell) + "38");
continue;
}
if (i == 40) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getTransactionAmount().toString());
continue;
}
if (i == 41) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getSixAddTax().toString());
sheet.getRow(i).getCell(beginCell).setCellFormula(LetterExcelUtil.NumToExcel(beginCell) + "39 * " + LetterExcelUtil.NumToExcel(beginCell) + "40");
}
if (i == 42) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getTotalAmountTax().toString());
sheet.getRow(i).getCell(beginCell).setCellFormula(LetterExcelUtil.NumToExcel(beginCell) + "41 * 6%");
continue;
}
if (i == 43) {
sheet.getRow(i).getCell(beginCell).setCellValue(ebitDataDto.getEbitSubtraction().toString());
sheet.getRow(i).getCell(beginCell).setCellFormula(LetterExcelUtil.NumToExcel(beginCell) + "41 * 1.06");
continue;
}
}
sheet.getRow(8).getCell(1).setCellValue("本年累计");
sheet.getRow(6).getCell(1).setCellValue(getOrgName(project.getOrganizationId()));
beginCell++;
}
}*/
private static final String headerEbitTitle = "汇总利润表";
public void insertExcelOne(CellStyle headerCellType, XSSFWorkbook workbook1, Sheet sheetAt, Integer _index, RequestParameterDto requestParameterDto) {
headerCellType.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直
headerCellType.setAlignment(HorizontalAlignment.CENTER);// 水平
......@@ -2955,6 +2892,7 @@ public class ReportServiceImpl extends BaseService {
font.setFontHeight(30);
headerCellType.setFont(font);
sheetAt.addMergedRegion(new CellRangeAddress(0, 0, 1, _index + 4));
sheetAt.getRow(0).getCell(1).setCellValue(headerEbitTitle);
sheetAt.getRow(0).getCell(1).setCellStyle(headerCellType);
POIStyleUtil.setCellBackgroundColor(workbook1, sheetAt.getRow(2).createCell(_index + 1), new XSSFColor(java.awt.Color.YELLOW));
sheetAt.getRow(2).getCell(_index + 1).setCellValue("本期:" + requestParameterDto.getPeriod());
......
......@@ -10,6 +10,7 @@ import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
......
......@@ -62,7 +62,7 @@
</choose>
<choose>
<when test="item.disposedDate != null">#{item.disposedDate,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.residualRate != null">#{item.residualRate,jdbcType=DECIMAL},</when>
......
......@@ -46,7 +46,7 @@
"TotalYearDifferenceAmount": "Total Year Difference Amount:",
"AdjustmentValue": "Adjustment Value",
"DisposedDate": "Disposed Date",
"ResidualRate": "Residual Rate",
"ResidualRate": "Residual Amount",
"ResidualValue": "Residual Value",
"TaxMonthDepreciationAmount": "Monthly Depreciation Amount(Tax)",
"TaxToCurrentYearDepreciationAmount": "Up To Current Year Depreciation Amount(Tax)",
......@@ -1158,6 +1158,14 @@
"BeginOfNextYear": "Begin Of Next Year",
"PreClassified": "Pre Classified",
"AssetType": "Asset Type",
"TaxGroupName": "TaxGroupName"
"TaxGroupName": "TaxGroupName",
"ProjectDescription": "Project Description",
"ProductDescription": "Product Description",
"Company":"Company",
"CompanyDescription": "Company Description",
"Segment1":"Segment1",
"Segment1Description": "Segment1 Description",
"Segment2":"Segment2",
"Segment2Description": "Segment2 Description"
}
\ No newline at end of file
......@@ -896,11 +896,11 @@
"InternationalDataImport":"国际税数据",
"TBEBITForm":"TP EBIT 表格",
"ClickEnsureTip": "请点击确定按钮!",
"MenuUnreturnedTax": "未返还税金分析",
"MenuTaxComparison": "未返还/返还后税金比较",
"MenuUnreturnedTax": "税负分析",
"MenuTaxComparison": "返还情况",
"MenuCostAnalysis": "费用分析",
"MenuProfitAndLoss": "利润/亏损分析",
"MenuOtherDomesticData": "其他国内数据",
"MenuProfitAndLoss": "利润分析",
"MenuOtherDomesticData": "个税分析",
"MenuDocSituation": "档案归档情况",
"MenuGlobalOverview": "全球概览",
"MenuMexicanTax": "墨西哥税务分析",
......
......@@ -46,7 +46,7 @@
"TotalYearDifferenceAmount": "差异额:",
"AdjustmentValue": "原值调整值",
"DisposedDate": "报废日期",
"ResidualRate": "残值",
"ResidualRate": "残值",
"ResidualValue": "残值",
"TaxMonthDepreciationAmount": "每月折旧额(税务)",
"TaxToCurrentYearDepreciationAmount": "截止本年累计折旧额(税务)",
......@@ -1212,8 +1212,13 @@
"PreClassified": "预提重分类",
"AssetType": "资产类型",
"TaxGroupName": "税务资产分类",
"ImportNotMatch" : "导入文件与选择机构或期间不匹配"
}
\ No newline at end of file
"ImportNotMatch" : "导入文件与选择机构或期间不匹配",
"ProjectDescription": "项目描述",
"ProductDescription": "产品描述",
"Company":"公司间",
"CompanyDescription": "公司间描述",
"Segment1":"备用段",
"Segment1Description": "备用段描述",
"Segment2":"备用段",
"Segment2Description": "备用段描述"
}
\ No newline at end of file
......@@ -896,6 +896,7 @@
onValueChanged: function (data) {
$scope.citAssetsListDto.taxAccountCompare = data.value;
$scope.taxAccountDifferenceOptions.value = data.value;
getAssetResultList($scope.displayType - 1);
}
};
......
......@@ -53,13 +53,24 @@
{ caption: $translate.instant('usableInvoiceAmount'), dataField: "usableInvoiceAmount", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('usableBalance'), dataField: "usableBalance", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('advanceWriteOff'), dataField: "advanceWriteOff", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('checkOne'), dataField: "checkOne", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('reclassifyAmount'), dataField: "reclassifyAmount", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('exchangeRate'), dataField: "exchangeRate", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('ledgerId'), dataField: "ledgerId", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('debitAdvanceGene'), dataField: "debitAdvanceGene", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('creditPrepaidAccounts'), dataField: "creditPrepaidAccounts", allowEditing: false, fixed: true,width: 150 },
{ caption: $translate.instant('remark'), dataField: "remark", allowEditing: false, fixed: true ,width: 150}
{ caption: $translate.instant('Account'), dataField: "subjectCode", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('AccountDescription'), dataField: "subjectDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('AuxiliarySubject'), dataField: "auxiliarySubject", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('AuxiliarySubjectDescription'), dataField: "auxiliarySubjectDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('RevSearchProfitCenterCode'), dataField: "profitCenter", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('RevSearchProfitCenterName'), dataField: "profitCenterDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('RevDetailProduct'), dataField: "product", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('ProductDescription'), dataField: "productDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('c_projectID'), dataField: "project", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('ProjectDescription'), dataField: "projectDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('Company'), dataField: "company", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('CompanyDescription'), dataField: "companyDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('Segment1'), dataField: "segment1", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('Segment1Description'), dataField: "segment1Description", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('Segment2'), dataField: "segment2", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('Segment2Description'), dataField: "segment2Description", allowEditing: false, fixed: true ,width: 150},
];
$scope.assetsResultGridOptions = {
......
......@@ -245,8 +245,8 @@
{caption: $translate.instant('AssetName'), dataField: "assetDescription",width: 200},
{caption: $translate.instant('BuyDate'), dataField: "buyDate", dataType: "date", format: "yyyy-MM-dd",width: 100},
{
caption: $translate.instant('DepreciationDate2'),
dataField: "depreciationDate",
caption: $translate.instant('DisposedDate'),
dataField: "disposedDate",
dataType: "date",
format: "yyyy-MM-dd",
width: 100
......
......@@ -1013,6 +1013,24 @@ debugger;
}
}
});
if ('export' == $scope.evenType) {
var xhr = new XMLHttpRequest();
xhr.onload = function (e) {
var arraybuffer = xhr.response;
exportToExcel(arraybuffer, vatSessionService.project.name + '-' + vatSessionService.month + '-纳税申报.xlsx');
$('#busy-indicator-container').hide();
};
xhr.open("POST", apiInterceptor.webApiHostUrl + '/citReport/exportReportData/' + vatSessionService.project.id + '/' + 0, true);
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.responseType = "arraybuffer";
xhr.send(JSON.stringify({
reportIds: reportIds
}));
return;
}
if ('upload' == $scope.evenType) {
var xhr = new XMLHttpRequest();
xhr.onload = function (e) {
......@@ -1105,6 +1123,105 @@ debugger;
return;
};
var exportToExcel = function (data, filename) {
var defer = $q.defer();
// var octetStreamMime = 'application/vnd.ms-excel';
var success = false;
// Get the headers
// headers = headers();
// Get the filename from the x-filename header or default to "download.bin"
// var filename = decodeURI(headers['x-file-name']) + defaultFileName;
// Determine the content type from the header or default to "application/octet-stream"
// var contentType = headers['content-type'] || octetStreamMime;
try {
// Try using msSaveBlob if supported
//console.log("Trying saveBlob method ...");
var blob = new Blob([data], {type: "arraybuffer"});
if (navigator.msSaveBlob)
navigator.msSaveBlob(blob, filename);
else {
// Try using other saveBlob implementations, if available
var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
if (saveBlob === undefined) throw "Not supported";
saveBlob(blob, filename);
}
//console.log("saveBlob succeeded");
success = true;
} catch (ex) {
$log.debug("saveBlob method failed with the following exception:");
$log.debug(ex);
}
if (!success) {
// Get the blob url creator
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
// Try to use a download link
var link = document.createElement('a');
if ('download' in link) {
// Try to simulate a click
try {
// Prepare a blob URL
//console.log("Trying download link method with simulated click ...");
var blobdownload = new Blob([data], {type: "arraybuffer"});
var urldownload = urlCreator.createObjectURL(blobdownload);
link.setAttribute('href', urldownload);
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
link.setAttribute("download", filename);
// Simulate clicking the download link
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
link.dispatchEvent(event);
//console.log("Download link method with simulated click succeeded");
success = true;
} catch (ex) {
$log.debug("Download link method with simulated click failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
if (!success) {
// Fallback to window.location method
try {
// Prepare a blob URL
// Use application/octet-stream when using window.location to force download
//console.log("Trying download link method with window.location ...");
var blobsuccess = new Blob([data], {type: "arraybuffer"});
var urlsuccess = urlCreator.createObjectURL(blobsuccess);
window.location = urlsuccess;
//console.log("Download link method with window.location succeeded");
success = true;
} catch (ex) {
//console.log("Download link method with window.location failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
}
}
if (!success) {
// Fallback to window.open method
$log.debug("No methods worked for saving the arraybuffer, using last resort window.open");
window.open(httpPath, '_blank', '');
}
//Delete the file
// deleteFile(encodeURI(filename));
defer.resolve('success');
return defer.promise;
};
var timeOutCount = 0;
function timeOutExportSpread(exportReportData) {
......
......@@ -185,6 +185,7 @@
withCredentials: true
}).then(function(resp) {
var ret = resp.data;
$scope.fileName='';
$('#busy-indicator-container').hide();
deferred.resolve();
if (ret.result) {
......
......@@ -171,6 +171,7 @@
__RequestVerificationToken: token,
withCredentials: true
}).then(function(data) {
$scope.fileName='';
$('#busy-indicator-container').hide();
var resp = data.data;
deferred.resolve();
......
......@@ -18,7 +18,7 @@
if (noExtendFileName) {
filename = defaultFileName+ "_" +vatSessionService.project.name+'.xls'
} 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 @@
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCFData/get', queryParm, thisConfig).then(function (response) {
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) {
......@@ -224,7 +224,7 @@
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportIRData/get', queryParm, thisConfig).then(function (response) {
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) {
......@@ -235,7 +235,7 @@
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCPRData/get', queryParm, thisConfig).then(function (response) {
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) {
......@@ -246,7 +246,7 @@
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportRLITData/get', queryParm, thisConfig).then(function (response) {
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) {
......@@ -268,7 +268,7 @@
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportIDData/get', queryParm, thisConfig).then(function (response) {
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