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 { ...@@ -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; ...@@ -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
*/ */
......
...@@ -25,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl; ...@@ -25,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -251,6 +252,34 @@ public class CitReportController { ...@@ -251,6 +252,34 @@ public class CitReportController {
return ResponseEntity.ok(reportService.addCellManualDataSource(data, from)); 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, @RequestMapping(value = "uploadReportData/{projectId}/{period}", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE) produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody @ResponseBody
......
...@@ -203,12 +203,19 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -203,12 +203,19 @@ public class AnalysisJobServiceImpl extends BaseService {
String regionMeg = regionMap.get(o.getRegionId()); String regionMeg = regionMap.get(o.getRegionId());
List<String> regionMs = Lists.newArrayList(); List<String> regionMs = Lists.newArrayList();
if (StringUtils.isNotEmpty(regionMeg)) { if (StringUtils.isNotEmpty(regionMeg)) {
regionMs = Arrays.asList(regionMeg.split(".")); regionMs = Arrays.asList(regionMeg.split(","));
} }
if (!regionMs.isEmpty()) { if (!regionMs.isEmpty()) {
am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : ""); if(regionMs.size() == 4){
am.setCity(regionMs.get(2) != null ? regionMs.get(2) : ""); am.setProvince(regionMs.get(1) != null ? regionMs.get(1) : "");
am.setDistrict(regionMs.get(3) != null ? regionMs.get(4) : ""); 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.setBusinessLine(buMap.get(o.getBusinessUnitId()));
am.setCode(o.getCode()); am.setCode(o.getCode());
...@@ -223,7 +230,8 @@ public class AnalysisJobServiceImpl extends BaseService { ...@@ -223,7 +230,8 @@ public class AnalysisJobServiceImpl extends BaseService {
} }
analysisMasterMapper.insertSelective(am); analysisMasterMapper.insertSelective(am);
} catch (Exception e) { } 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 { ...@@ -932,7 +932,7 @@ public class AnalysisServiceImpl extends BaseService {
.andCompanyNameEqualTo(getCellValue(sheetAt.getRow(i).getCell(3), false).toString()) .andCompanyNameEqualTo(getCellValue(sheetAt.getRow(i).getCell(3), false).toString())
.andPeriodEqualTo(period); .andPeriodEqualTo(period);
List<AnalysisMaster> analysisMasters = analysisMasterMapper.selectByExample(example); List<AnalysisMaster> analysisMasters = analysisMasterMapper.selectByExample(example);
if (breakFlag > 3) { if (breakFlag > 20) {
logger.info("大于三条数据不匹配,直接停止进程"); logger.info("大于三条数据不匹配,直接停止进程");
break; break;
} }
...@@ -962,8 +962,14 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -962,8 +962,14 @@ public class AnalysisServiceImpl extends BaseService {
salesList.add(sales); salesList.add(sales);
} }
} }
int salesInt = analysisSalesMapper.insertBatch(salesList); int salesInt = 0;
int taxInt = analysisTaxMapper.insertBatch(taxList); 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_salesInt 更新数据条数" + salesInt);
logger.info("analysis_tax 更新数据条数" + taxInt); logger.info("analysis_tax 更新数据条数" + taxInt);
System.out.println("数据初始化消耗: " + (System.currentTimeMillis() - now)); System.out.println("数据初始化消耗: " + (System.currentTimeMillis() - now));
......
...@@ -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));
......
...@@ -1047,7 +1047,7 @@ public class DataImportService extends BaseService { ...@@ -1047,7 +1047,7 @@ public class DataImportService extends BaseService {
} }
if (validateRes && EnumTbImportType.CoverImport.getCode().equals(importType)) { if (validateRes && EnumTbImportType.CoverImport.getCode().equals(importType)) {
RedLetterInfoTableExample redLetterInfoTableExample = new RedLetterInfoTableExample(); 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.deleteByExample(redLetterInfoTableExample);
} }
redLetterInfoTableMapper.insertBatch(rlits); redLetterInfoTableMapper.insertBatch(rlits);
......
...@@ -1332,62 +1332,76 @@ public class ReportServiceImpl extends BaseService { ...@@ -1332,62 +1332,76 @@ public class ReportServiceImpl extends BaseService {
ebit = new EbitCellData(); ebit = new EbitCellData();
switch (profitLossStatement.getItemName().trim()) { switch (profitLossStatement.getItemName().trim()) {
case "一、营业收入": case "一、营业收入":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(11); ebit.setRow(11);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "减:营业成本": case "减:营业成本":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(12); ebit.setRow(12);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "营业税金及附加": case "营业税金及附加":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(13); ebit.setRow(13);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "销售费用": case "销售费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(14); ebit.setRow(14);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "管理费用": case "管理费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(15); ebit.setRow(15);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "研发费用": case "研发费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(16); ebit.setRow(16);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "财务费用": case "财务费用":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(17); ebit.setRow(17);
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
break; break;
case "资产减值损失": case "资产减值损失":
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setCol(2);
ebit.setRow(18); ebit.setRow(18);
ebit.setOrganizationId(profitLossStatement.getOrganizationId()); break;
ebit.setPeriod(profitLossStatement.getPeriod()); 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; break;
} }
///ebit.setCol(2);
ebit.setData(profitLossStatement.getYtdAmt().toString());
ebit.setOrganizationId(profitLossStatement.getOrganizationId());
ebit.setPeriod(profitLossStatement.getPeriod());
list1.add(ebit); list1.add(ebit);
} }
return list1; return list1;
...@@ -1700,27 +1714,28 @@ public class ReportServiceImpl extends BaseService { ...@@ -1700,27 +1714,28 @@ public class ReportServiceImpl extends BaseService {
BigDecimal yffy = new BigDecimal(0);//研发费用 BigDecimal yffy = new BigDecimal(0);//研发费用
BigDecimal zcjzss = new BigDecimal(0); //资产减值损失 BigDecimal zcjzss = new BigDecimal(0); //资产减值损失
for (CellDataDto cellDataDto : cellDataDtoList) { for (CellDataDto cellDataDto : cellDataDtoList) {
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 11) { //一、营业收入 switch (cellDataDto.getColumnIndex() + ":" + cellDataDto.getRowIndex()) {
yysr = new BigDecimal(cellDataDto.getCellValue()); case "2:11":
continue; yysr = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 12) {//减:营业成本 case "2:12":
yycb = new BigDecimal(cellDataDto.getCellValue()); yycb = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 13) {//营业税金及附加 case "2:13":
yysjfj = new BigDecimal(cellDataDto.getCellValue()); yysjfj = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 14) {//销售费用 case "2:14":
xsfy = new BigDecimal(cellDataDto.getCellValue()); xsfy = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 15) {//管理费用 case "2:15":
glfy = new BigDecimal(cellDataDto.getCellValue()); glfy = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 16) {//研发费用 case "2:16":
yffy = new BigDecimal(cellDataDto.getCellValue()); yffy = new BigDecimal(cellDataDto.getCellValue());
} break;
if (cellDataDto.getColumnIndex() == 2 && cellDataDto.getRowIndex() == 18) {//资产减值损失 case "2:18":
zcjzss = new BigDecimal(cellDataDto.getCellValue()); zcjzss = new BigDecimal(cellDataDto.getCellValue());
break;
} }
} }
BigDecimal subtract = yysr.subtract(yycb).add(yysjfj).add(xsfy).add(glfy).add(yffy).add(zcjzss); BigDecimal subtract = yysr.subtract(yycb).add(yysjfj).add(xsfy).add(glfy).add(yffy).add(zcjzss);
...@@ -1778,6 +1793,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1778,6 +1793,7 @@ public class ReportServiceImpl extends BaseService {
return ebitDataDto; return ebitDataDto;
} }
public EbitDataDto calculateEbitDataByEbit(List<EbitCellData> ebitCellData, String specialConsiderations, String ebitRate) { public EbitDataDto calculateEbitDataByEbit(List<EbitCellData> ebitCellData, String specialConsiderations, String ebitRate) {
EbitDataDto ebitDataDto = new EbitDataDto(); EbitDataDto ebitDataDto = new EbitDataDto();
try { try {
...@@ -1803,6 +1819,8 @@ public class ReportServiceImpl extends BaseService { ...@@ -1803,6 +1819,8 @@ public class ReportServiceImpl extends BaseService {
BigDecimal yffy = new BigDecimal(0);//研发费用 BigDecimal yffy = new BigDecimal(0);//研发费用
BigDecimal zcjzss = new BigDecimal(0); //资产减值损失 BigDecimal zcjzss = new BigDecimal(0); //资产减值损失
for (EbitCellData ebitCellData1 : ebitCellData) { for (EbitCellData ebitCellData1 : ebitCellData) {
if (ebitCellData1.getRow() == null)
continue;
if (ebitCellData1.getCol() == 2 && ebitCellData1.getRow() == 11) { //一、营业收入 if (ebitCellData1.getCol() == 2 && ebitCellData1.getRow() == 11) { //一、营业收入
if (StringUtils.isNotEmpty(ebitCellData1.getData())) yysr = new BigDecimal(ebitCellData1.getData()); if (StringUtils.isNotEmpty(ebitCellData1.getData())) yysr = new BigDecimal(ebitCellData1.getData());
continue; continue;
...@@ -2705,9 +2723,9 @@ public class ReportServiceImpl extends BaseService { ...@@ -2705,9 +2723,9 @@ public class ReportServiceImpl extends BaseService {
Map<String, List<ProfitLossStatementPrc>> newMap = new HashMap<>(); Map<String, List<ProfitLossStatementPrc>> newMap = new HashMap<>();
///如果ebitCellData 中已经存在当前机构的数,将取 ebit中,否则取利润表中 ///如果ebitCellData 中已经存在当前机构的数,将取 ebit中,否则取利润表中
if(collect1.isEmpty()){ if (collect1.isEmpty()) {
newMap = collect2; newMap = collect2;
}else{ } else {
for (Map.Entry<String, List<EbitCellData>> entry1 : collect1.entrySet()) { for (Map.Entry<String, List<EbitCellData>> entry1 : collect1.entrySet()) {
for (Map.Entry<String, List<ProfitLossStatementPrc>> entry2 : collect2.entrySet()) { for (Map.Entry<String, List<ProfitLossStatementPrc>> entry2 : collect2.entrySet()) {
/*System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());*/ /*System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());*/
...@@ -2729,7 +2747,6 @@ public class ReportServiceImpl extends BaseService { ...@@ -2729,7 +2747,6 @@ public class ReportServiceImpl extends BaseService {
sheetAt = workbook1.getSheetAt(0); sheetAt = workbook1.getSheetAt(0);
List<Integer> cols = Lists.newArrayList(); List<Integer> cols = Lists.newArrayList();
FileExcelUtil.deleteColumn(sheetAt, 1, cols); FileExcelUtil.deleteColumn(sheetAt, 1, cols);
List<String> ebitTitle = Lists.newArrayList("EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"); List<String> ebitTitle = Lists.newArrayList("EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额");
//设置单元格居右 //设置单元格居右
cellStyle1 = workbook1.createCellStyle();//创建样式 cellStyle1 = workbook1.createCellStyle();//创建样式
...@@ -2754,10 +2771,19 @@ public class ReportServiceImpl extends BaseService { ...@@ -2754,10 +2771,19 @@ public class ReportServiceImpl extends BaseService {
ebitCellDataList.add(ebitDataDto); ebitCellDataList.add(ebitDataDto);
} }
} else { } 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++) { for (int m = 0; m <= sheetAt.getLastRowNum(); m++) {
switch (m) { switch (m) {
case 7: case 7:
...@@ -2783,6 +2809,8 @@ public class ReportServiceImpl extends BaseService { ...@@ -2783,6 +2809,8 @@ public class ReportServiceImpl extends BaseService {
break; break;
if (sheetAt.getRow(m) != null && sheetAt.getRow(m).getCell(_index + 1) != null) { if (sheetAt.getRow(m) != null && sheetAt.getRow(m).getCell(_index + 1) != null) {
for (EbitCellData ebitCellData : entry.getValue()) { for (EbitCellData ebitCellData : entry.getValue()) {
if (ebitCellData.getRow() == null)
continue;
if (m == ebitCellData.getRow()) { if (m == ebitCellData.getRow()) {
try { try {
sheetAt.getRow(m).getCell(_index + 1).setCellValue(ebitCellData.getData().equals("") == true ? "0" : ebitCellData.getData()); sheetAt.getRow(m).getCell(_index + 1).setCellValue(ebitCellData.getData().equals("") == true ? "0" : ebitCellData.getData());
...@@ -2795,77 +2823,45 @@ public class ReportServiceImpl extends BaseService { ...@@ -2795,77 +2823,45 @@ public class ReportServiceImpl extends BaseService {
//cell.setCellType(cellStyle.getAlignment()); //cell.setCellType(cellStyle.getAlignment());
} }
if (m >= 37) {//加载ebit数据 if (m >= 37) {//加载ebit数据
for (EbitDataDto ebitCellData : ebitCellDataList) { for (int i = 0; i < ebitCellDataList.size(); i++) {
switch (m) { switch (m) {
case 37: case 37:
addFormula(cellAndOrCreate(m, _index + 1, addFormula(cellAndOrCreate(m, _index + 1,
ebitCellData.getEbitSubtraction().toString(), ebitCellDataList.get(_index).getEbitSubtraction().toString(),
sheetAt), Lists.newArrayList("12- ", "13- ", "14- ", "15- ", "16- ", "18"), _index + 1); sheetAt), Lists.newArrayList("12- ", "13- ", "14- ", "15- ", "16- ", "17-", "19"), _index + 1);
break; break;
case 38: case 38:
cellAndOrCreate(m, _index + 1, ebitCellData.getSpecialConsiderations(), sheetAt); cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getSpecialConsiderations(), sheetAt);
break; break;
case 39: 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); Lists.newArrayList("38+ ", "39"), _index + 1);
break; break;
case 40: case 40:
cellAndOrCreate(m, _index + 1, ebitCellData.getEbitRate(), sheetAt); cellAndOrCreate(m, _index + 1, ebitCellDataList.get(_index).getEbitRate(), sheetAt);
break; break;
case 41: 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); Lists.newArrayList("40 * ", "41"), _index + 1);
break; break;
case 42: 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; break;
case 43: 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;
} }
break;
} }
} }
} }
_index++; _index++;
} }
sheetAt.setForceFormulaRecalculation(true);//强制执行公式
///合并单元格 ///合并单元格
insertExcelOne(headerCellType, workbook1, sheetAt, _index, requestParameterDto); 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.setExcelHeadInfo(response, request, requestParameterDto.getPeriod() + "-汇总利润表.xlsx");
FileExcelUtil.downloadExcel(request, response, requestParameterDto.getPeriod() + "-汇总利润表.xlsx", workbook1); FileExcelUtil.downloadExcel(request, response, requestParameterDto.getPeriod() + "-汇总利润表.xlsx", workbook1);
} }
...@@ -2887,66 +2883,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2887,66 +2883,7 @@ public class ReportServiceImpl extends BaseService {
sheetAt.getRow(row).getCell(col).setCellStyle(cellStyle1); sheetAt.getRow(row).getCell(col).setCellStyle(cellStyle1);
return sheetAt.getRow(row).getCell(col); return sheetAt.getRow(row).getCell(col);
} }
/* public void insertData(String templateId, Integer period, Sheet sheet, int beginCell) { private static final String headerEbitTitle = "汇总利润表";
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++;
}
}*/
public void insertExcelOne(CellStyle headerCellType, XSSFWorkbook workbook1, Sheet sheetAt, Integer _index, RequestParameterDto requestParameterDto) { public void insertExcelOne(CellStyle headerCellType, XSSFWorkbook workbook1, Sheet sheetAt, Integer _index, RequestParameterDto requestParameterDto) {
headerCellType.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直 headerCellType.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直
headerCellType.setAlignment(HorizontalAlignment.CENTER);// 水平 headerCellType.setAlignment(HorizontalAlignment.CENTER);// 水平
...@@ -2955,6 +2892,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2955,6 +2892,7 @@ public class ReportServiceImpl extends BaseService {
font.setFontHeight(30); font.setFontHeight(30);
headerCellType.setFont(font); headerCellType.setFont(font);
sheetAt.addMergedRegion(new CellRangeAddress(0, 0, 1, _index + 4)); sheetAt.addMergedRegion(new CellRangeAddress(0, 0, 1, _index + 4));
sheetAt.getRow(0).getCell(1).setCellValue(headerEbitTitle);
sheetAt.getRow(0).getCell(1).setCellStyle(headerCellType); sheetAt.getRow(0).getCell(1).setCellStyle(headerCellType);
POIStyleUtil.setCellBackgroundColor(workbook1, sheetAt.getRow(2).createCell(_index + 1), new XSSFColor(java.awt.Color.YELLOW)); POIStyleUtil.setCellBackgroundColor(workbook1, sheetAt.getRow(2).createCell(_index + 1), new XSSFColor(java.awt.Color.YELLOW));
sheetAt.getRow(2).getCell(_index + 1).setCellValue("本期:" + requestParameterDto.getPeriod()); sheetAt.getRow(2).getCell(_index + 1).setCellValue("本期:" + requestParameterDto.getPeriod());
......
...@@ -10,6 +10,7 @@ import pwc.taxtech.atms.common.util.DateUtils; ...@@ -10,6 +10,7 @@ import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.EnumTbImportType; import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.entity.Organization; import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample; import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</choose> </choose>
<choose> <choose>
<when test="item.disposedDate != null">#{item.disposedDate,jdbcType=TIMESTAMP},</when> <when test="item.disposedDate != null">#{item.disposedDate,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise> <otherwise>null,</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.residualRate != null">#{item.residualRate,jdbcType=DECIMAL},</when> <when test="item.residualRate != null">#{item.residualRate,jdbcType=DECIMAL},</when>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"TotalYearDifferenceAmount": "Total Year Difference Amount:", "TotalYearDifferenceAmount": "Total Year Difference Amount:",
"AdjustmentValue": "Adjustment Value", "AdjustmentValue": "Adjustment Value",
"DisposedDate": "Disposed Date", "DisposedDate": "Disposed Date",
"ResidualRate": "Residual Rate", "ResidualRate": "Residual Amount",
"ResidualValue": "Residual Value", "ResidualValue": "Residual Value",
"TaxMonthDepreciationAmount": "Monthly Depreciation Amount(Tax)", "TaxMonthDepreciationAmount": "Monthly Depreciation Amount(Tax)",
"TaxToCurrentYearDepreciationAmount": "Up To Current Year Depreciation Amount(Tax)", "TaxToCurrentYearDepreciationAmount": "Up To Current Year Depreciation Amount(Tax)",
...@@ -1158,6 +1158,14 @@ ...@@ -1158,6 +1158,14 @@
"BeginOfNextYear": "Begin Of Next Year", "BeginOfNextYear": "Begin Of Next Year",
"PreClassified": "Pre Classified", "PreClassified": "Pre Classified",
"AssetType": "Asset Type", "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 @@ ...@@ -896,11 +896,11 @@
"InternationalDataImport":"国际税数据", "InternationalDataImport":"国际税数据",
"TBEBITForm":"TP EBIT 表格", "TBEBITForm":"TP EBIT 表格",
"ClickEnsureTip": "请点击确定按钮!", "ClickEnsureTip": "请点击确定按钮!",
"MenuUnreturnedTax": "未返还税金分析", "MenuUnreturnedTax": "税负分析",
"MenuTaxComparison": "未返还/返还后税金比较", "MenuTaxComparison": "返还情况",
"MenuCostAnalysis": "费用分析", "MenuCostAnalysis": "费用分析",
"MenuProfitAndLoss": "利润/亏损分析", "MenuProfitAndLoss": "利润分析",
"MenuOtherDomesticData": "其他国内数据", "MenuOtherDomesticData": "个税分析",
"MenuDocSituation": "档案归档情况", "MenuDocSituation": "档案归档情况",
"MenuGlobalOverview": "全球概览", "MenuGlobalOverview": "全球概览",
"MenuMexicanTax": "墨西哥税务分析", "MenuMexicanTax": "墨西哥税务分析",
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"TotalYearDifferenceAmount": "差异额:", "TotalYearDifferenceAmount": "差异额:",
"AdjustmentValue": "原值调整值", "AdjustmentValue": "原值调整值",
"DisposedDate": "报废日期", "DisposedDate": "报废日期",
"ResidualRate": "残值", "ResidualRate": "残值",
"ResidualValue": "残值", "ResidualValue": "残值",
"TaxMonthDepreciationAmount": "每月折旧额(税务)", "TaxMonthDepreciationAmount": "每月折旧额(税务)",
"TaxToCurrentYearDepreciationAmount": "截止本年累计折旧额(税务)", "TaxToCurrentYearDepreciationAmount": "截止本年累计折旧额(税务)",
...@@ -1212,8 +1212,13 @@ ...@@ -1212,8 +1212,13 @@
"PreClassified": "预提重分类", "PreClassified": "预提重分类",
"AssetType": "资产类型", "AssetType": "资产类型",
"TaxGroupName": "税务资产分类", "TaxGroupName": "税务资产分类",
"ImportNotMatch" : "导入文件与选择机构或期间不匹配" "ImportNotMatch" : "导入文件与选择机构或期间不匹配",
"ProjectDescription": "项目描述",
"ProductDescription": "产品描述",
"Company":"公司间",
} "CompanyDescription": "公司间描述",
\ No newline at end of file "Segment1":"备用段",
"Segment1Description": "备用段描述",
"Segment2":"备用段",
"Segment2Description": "备用段描述"
}
\ No newline at end of file
...@@ -896,6 +896,7 @@ ...@@ -896,6 +896,7 @@
onValueChanged: function (data) { onValueChanged: function (data) {
$scope.citAssetsListDto.taxAccountCompare = data.value; $scope.citAssetsListDto.taxAccountCompare = data.value;
$scope.taxAccountDifferenceOptions.value = data.value;
getAssetResultList($scope.displayType - 1); getAssetResultList($scope.displayType - 1);
} }
}; };
......
...@@ -53,13 +53,24 @@ ...@@ -53,13 +53,24 @@
{ caption: $translate.instant('usableInvoiceAmount'), dataField: "usableInvoiceAmount", allowEditing: false, fixed: true,width: 150 }, { 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('usableBalance'), dataField: "usableBalance", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('advanceWriteOff'), dataField: "advanceWriteOff", 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('Account'), dataField: "subjectCode", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('exchangeRate'), dataField: "exchangeRate", allowEditing: false, fixed: true ,width: 150}, { caption: $translate.instant('AccountDescription'), dataField: "subjectDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('ledgerId'), dataField: "ledgerId", allowEditing: false, fixed: true,width: 150 }, { caption: $translate.instant('AuxiliarySubject'), dataField: "auxiliarySubject", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('debitAdvanceGene'), dataField: "debitAdvanceGene", allowEditing: false, fixed: true,width: 150 }, { caption: $translate.instant('AuxiliarySubjectDescription'), dataField: "auxiliarySubjectDescription", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('creditPrepaidAccounts'), dataField: "creditPrepaidAccounts", allowEditing: false, fixed: true,width: 150 }, { caption: $translate.instant('RevSearchProfitCenterCode'), dataField: "profitCenter", allowEditing: false, fixed: true ,width: 150},
{ caption: $translate.instant('remark'), dataField: "remark", 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 = { $scope.assetsResultGridOptions = {
......
...@@ -245,8 +245,8 @@ ...@@ -245,8 +245,8 @@
{caption: $translate.instant('AssetName'), dataField: "assetDescription",width: 200}, {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('BuyDate'), dataField: "buyDate", dataType: "date", format: "yyyy-MM-dd",width: 100},
{ {
caption: $translate.instant('DepreciationDate2'), caption: $translate.instant('DisposedDate'),
dataField: "depreciationDate", dataField: "disposedDate",
dataType: "date", dataType: "date",
format: "yyyy-MM-dd", format: "yyyy-MM-dd",
width: 100 width: 100
......
...@@ -1013,6 +1013,24 @@ debugger; ...@@ -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) { if ('upload' == $scope.evenType) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onload = function (e) { xhr.onload = function (e) {
...@@ -1105,6 +1123,105 @@ debugger; ...@@ -1105,6 +1123,105 @@ debugger;
return; 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; var timeOutCount = 0;
function timeOutExportSpread(exportReportData) { function timeOutExportSpread(exportReportData) {
......
...@@ -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