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

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 7f08eb48 9c653913
......@@ -443,20 +443,30 @@
<profiles>
<profile>
<id>dev</id>
<build>
<filters>
<filter>src/main/resources/conf/conf_profile_dev.properties</filter>
</filters>
</build>
<properties>
<env>dev</env>
</properties>
</profile>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
<filter>src/main/resources/conf/conf_profile_dev.properties</filter>
<filter>src/main/resources/conf/conf_profile_dev_local.properties</filter>
</filters>
</build>
<properties>
<env>dev</env>
</properties>
</profile>
<profile>
<id>staging</id>
<build>
......@@ -617,7 +627,7 @@
</dependencies>
</plugin>
<!-- See: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven -->
<plugin>
<plugin>ll
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
......
......@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -19,11 +20,13 @@ import java.util.Locale;
* version 1.0
*/
public class ThousandConvert extends JsonSerializer<BigDecimal> {
@Override
public void serialize(BigDecimal value, JsonGenerator jgen, SerializerProvider arg2)
throws IOException {
jgen.writeString(NumberFormat.getIntegerInstance(Locale.getDefault()).format(value));
NumberFormat integerInstance = NumberFormat.getIntegerInstance(Locale.getDefault());
integerInstance.setMinimumFractionDigits(2);
integerInstance.setRoundingMode(RoundingMode.HALF_UP);
integerInstance.setGroupingUsed(true);
jgen.writeString(integerInstance.format(value));
}
}
package pwc.taxtech.atms.dto.analysis;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.ThousandConvert;
import java.math.BigDecimal;
/**
......@@ -10,15 +13,19 @@ import java.math.BigDecimal;
public class AnalysisActualTaxReturnDto {
private String companyName;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal segment1;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal segment2;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal segment3;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal segment4;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal segment5;
public String getCompanyName() {
......
package pwc.taxtech.atms.dto.analysis;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.ThousandConvert;
import java.math.BigDecimal;
/**
......@@ -11,6 +14,7 @@ public class AnalysisDriverNumDto {
private String driverType;
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal driverNum;
public String getDriverType() {
......
package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.ThousandConvert;
import java.math.BigDecimal;
/**
......@@ -10,11 +13,16 @@ import java.math.BigDecimal;
* Version 1.0
**/
public class EbitDataDto {
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal ebitSubtraction; // 1. EBIT(考虑资产减值损失)
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal specialFactors; //考虑特殊因素
private String ebitRate;// ebit比率 默认1%(可更改)
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal transactionAmount; //关联交易金额
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal sixAddTax; //6%增值税
@JsonSerialize(using = ThousandConvert.class)
private BigDecimal totalAmountTax;// 价税合计金额
private String specialConsiderations;//特殊因素考虑
public String getSpecialConsiderations() {
......@@ -26,8 +34,6 @@ public class EbitDataDto {
}
public BigDecimal getEbitSubtraction() {
return ebitSubtraction;
}
......
......@@ -57,6 +57,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
public PageInfo<CitJournalAdjustDto> getJournalMergeData(CitJournalAdjustDto citJournalAdjustDto) {
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
List<String> orgList = getOrgList(citJournalAdjustDto.getProjectId());
//判断选择的期间是否为12月,若为12月份则需查询出到13期的内容
if (citJournalEntryAdjust.getPeriodEnd() != null && citJournalEntryAdjust.getPeriodEnd() % 100 == 12) {
citJournalEntryAdjust.setPeriodEnd(citJournalEntryAdjust.getPeriodEnd() / 100 * 100 + 13);
}
......
......@@ -234,7 +234,7 @@ public class CitReportServiceImpl extends BaseService {
setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
reportGenerator.citUpdateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
//===============================================start validation compute==========================================================
//todo: 1.get the data from workbook, then put the data into new workbook
......@@ -1704,7 +1704,7 @@ public class CitReportServiceImpl extends BaseService {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Workbook tWorkbook = null;
try {
tWorkbook = reportGenerator.createWorkBookByPeriodTemplate(dataList);
tWorkbook = reportGenerator.createCitWorkBookByPeriodTemplate(dataList);
tWorkbook.write(bout);
// FileUpload fileUpload = didiFileUploadService.uploadFile(bout.toByteArray(), "demo.xlsx", FileUploadEnum.BizSource.PERIOD_REPORT_TEMPLATE_UPLOAD.name());
......
......@@ -44,6 +44,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.apache.poi.ss.usermodel.Cell.CELL_TYPE_FORMULA;
import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
......@@ -327,252 +328,6 @@ public class ReportGeneratorImpl {
}
}
/**
* create by zhikai.z.wei 更改正则表达式,匹配E13-D13这种公式,要不然此单元格设置为允许手工数据后页面不能计算出实际值
* @param projectId
* @param period
* @param workbook
* @param resources
* @param isMergeMunual
* @param job
*/
public void citUpdateWorkbookCaclsValueToDb(String projectId, Integer period, Workbook workbook, PeriodResources resources,
Boolean isMergeMunual, PeriodJob job) {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName();
logger.info("-------------------------------------Begin Job [{}]------------------------------------------------------", code);
setStatus(job, STATUS_END);
setStatus(job, code, STATUS_BEGIN);
job.setCurrentStep(code);
periodJobMapper.updateByPrimaryKey(job);
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code))
.findFirst();
Long templateId;
if (periodTemplate.isPresent()) {
templateId = periodTemplate.get().getTemplateId();
} else {
templateId = 0L;
}
if (templateId > 0) {
PeriodReport report = new PeriodReport();
Long reportId = distributedIdService.nextId();
report.setId(reportId);
report.setTemplateId(templateId);
report.setPeriod(period);
report.setProjectId(projectId);
report.setCreateBy("Admin");
report.setCreateTime(new Date());
report.setUpdateBy("Admin");
report.setUpdateTime(new Date());
report.setProjectId(projectId);
reportMapper.insertSelective(report);
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.Formula.getCode()))
.collect(Collectors.toList());
//update formulablock table reportid field
List<Long> cellTemplateConfigIds = periodCellTemplateConfigs.stream()
.map(PeriodCellTemplateConfig::getCellTemplateId)
.collect(Collectors.toList());
if (cellTemplateConfigIds.size() > 0) {
periodFormulaBlockMapper.updateReportId(reportId, cellTemplateConfigIds, period, projectId);
}
for (PeriodCellTemplateConfig periodCellTemplateConfig : periodCellTemplateConfigs) {
PeriodFormulaBlockExample periodFormulaBlockExample2 = new PeriodFormulaBlockExample();
periodFormulaBlockExample2.createCriteria()
.andProjectIdEqualTo(projectId)
.andCellTemplateIdEqualTo(periodCellTemplateConfig.getCellTemplateId())
.andReportIdEqualTo(reportId)
.andPeriodEqualTo(period);
List<PeriodFormulaBlock> periodFormulaBlocks = periodFormulaBlockMapper.selectByExample(periodFormulaBlockExample2);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
// String regex = "[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\:\\u4e00-\\u9fa5\\%]*\\)";
String regex = "([A-Z]*\\([^(^)]*\\))|(([A-Z]*[0-9]*((\\+|\\-|\\*|\\/))*)*)";
Pattern p = Pattern.compile(regex);
String sourceFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ?
periodCellTemplateConfig.getKeyValueParsedFormula() :
periodCellTemplateConfig.getFormula();
String resultFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ?
periodCellTemplateConfig.getKeyValueParsedFormula() :
periodCellTemplateConfig.getFormula();
Matcher m = p.matcher(sourceFormula);
Boolean isFind = false;
while (m.find()) {
isFind = true;
//如果有些公式无法用正则匹配,可以做特殊处理
String findStr = m.group();
Optional<PeriodFormulaBlock> formulaBlock = periodFormulaBlocks.stream()
.filter(a -> a.getFormulaExpression().equals(findStr))
.findFirst();
if (formulaBlock.isPresent()) {
resultFormula = resultFormula.replace(findStr, formulaBlock.get().getData());
}
}
//如果有正则匹配就进行更新公式解析
if (isFind) {
periodCellTemplateConfig.setParsedFormula(StringUtils.isNotBlank(resultFormula) ? resultFormula : null);
periodCellTemplateConfigMapper.updateByPrimaryKeySelective(periodCellTemplateConfig);
}
Optional<PeriodCellTemplate> tempPeriodCellTemplate = resources.getPeriodCellTemplates().stream()
.filter(a -> a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId()))
.findFirst();
if (tempPeriodCellTemplate.isPresent()) {
PeriodCellData cellData = new PeriodCellData();
Long cellDataId = distributedIdService.nextId();
cellData.setId(cellDataId);
cellData.setReportId(reportId);
cellData.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
String data;
if (sheet.getRow(tempPeriodCellTemplate.get().getRowIndex()) != null
&& sheet.getRow(tempPeriodCellTemplate.get().getRowIndex())
.getCell(tempPeriodCellTemplate.get().getColumnIndex()) != null) {
Cell cell = sheet.getRow(tempPeriodCellTemplate.get().getRowIndex())
.getCell(tempPeriodCellTemplate.get().getColumnIndex());
data = ((XSSFCell) cell).getRawValue();
if (data != null && data.equals("#VALUE!")) {
FormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook);
try {
data = formulaEvaluator.evaluate(cell).getStringValue();
} catch (Exception e) {
logger.error(e.getStackTrace().toString());
data = "0.0";
}
}
} else {
data = "0.0";
}
if (StringUtils.isNotBlank(data)) {
Pattern pattern = Pattern.compile("[0-9.]*");
Matcher isNum = pattern.matcher(data);
if (isNum.matches()) {
cellData.setData(new BigDecimal(data).toString());
} else {
cellData.setData(data);
}
} else {
cellData.setData(data);
}
if (StringUtils.isBlank(resultFormula)) {
resultFormula = " ";
}
cellData.setFormulaExp(resultFormula);
cellData.setCreateBy("Admin");
cellData.setCreateTime(new Date());
cellData.setUpdateBy("Admin");
cellData.setUpdateTime(new Date());
cellData.setProjectId(projectId);
cellData.setPeriod(period);
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andPeriodEqualTo(period).andProjectIdEqualTo(projectId)
.andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId()).andTypeNotEqualTo(10);
List<PeriodDataSource> dataSourceList = SpringContextUtil.periodDataSourceMapper.selectByExample(dataSourceExample);
for (int ii = 0; ii < dataSourceList.size(); ii++) {
PeriodDataSource dataSource = dataSourceList.get(ii);
PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
cellDataSource.setCellDataId(cellDataId);
cellDataSource.setDataSourceId(dataSource.getId());
cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date());
cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
}
periodCellDataMapper.insertSelective(cellData);
}
}
if (isMergeMunual) {
List<PeriodCellTemplateConfig> keyInCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getReportTemplateId().equals(templateId) && a.getDataSourceType().equals(CellDataSourceType.KeyIn.getCode()))
.collect(Collectors.toList());
for (PeriodCellTemplateConfig keyInCellTemplateConfig : keyInCellTemplateConfigs) {
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andPeriodEqualTo(period).andProjectIdEqualTo(projectId)
.andCellTemplateIdEqualTo(keyInCellTemplateConfig.getCellTemplateId()).andTypeEqualTo(10);
List<PeriodDataSource> dataSourceList = SpringContextUtil.periodDataSourceMapper.selectByExample(dataSourceExample);
if (!dataSourceList.isEmpty() && dataSourceList.size() == 1) {
PeriodCellDataExample cellDataExample = new PeriodCellDataExample();
cellDataExample.createCriteria().andPeriodEqualTo(period).andProjectIdEqualTo(projectId)
.andCellTemplateIdEqualTo(keyInCellTemplateConfig.getCellTemplateId());
List<PeriodCellData> cellDataList = periodCellDataMapper.selectByExample(cellDataExample);
if (cellDataList.size() == 1) {
PeriodCellData cellData = cellDataList.get(0);
PeriodDataSource dataSource = dataSourceList.get(0);
if (StringUtils.isEmpty(cellData.getData().trim()))
cellData.setData("0.0");
if (StringUtils.isEmpty(cellData.getFormulaExp().trim()))
cellData.setFormulaExp("0.0");
PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellTemplateId(keyInCellTemplateConfig.getCellTemplateId());
cellDataSource.setCellDataId(cellData.getId());
cellDataSource.setDataSourceId(dataSource.getId());
cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date());
cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} else if (cellDataList.isEmpty()) {
PeriodCellData cellData = new PeriodCellData();
Long cellDataId = distributedIdService.nextId();
cellData.setId(cellDataId);
cellData.setReportId(reportId);
cellData.setCellTemplateId(keyInCellTemplateConfig.getCellTemplateId());
cellData.setCreateBy("Admin");
cellData.setCreateTime(new Date());
cellData.setUpdateBy("Admin");
cellData.setUpdateTime(new Date());
cellData.setProjectId(projectId);
cellData.setPeriod(period);
PeriodDataSource dataSource = dataSourceList.get(0);
cellData.setData("0.0");
cellData.setFormulaExp("0.0");
PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellTemplateId(keyInCellTemplateConfig.getCellTemplateId());
cellDataSource.setCellDataId(cellData.getId());
cellDataSource.setDataSourceId(dataSource.getId());
cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date());
cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
periodCellDataMapper.insertSelective(cellData);
} else {
logger.warn("should not be !!!");
}
}
}
}
}
logger.info("-------------------------------------End Job [{}]------------------------------------------------------", code);
}
}
private List<PeriodReport> createReportsByTemplates(Workbook
workbook, List<PeriodTemplate> periodTemplateList, String projectId, Integer period) {
List<PeriodReport> reports = new ArrayList<>();
......@@ -832,6 +587,74 @@ public class ReportGeneratorImpl {
}
}
public Workbook createCitWorkBookByPeriodTemplate(List<PeriodTemplate> templates) {
{
Workbook workbook = new XSSFWorkbook();
try {
String filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templates.forEach(a -> {
Workbook tWorkbook = null;
File file = null;
if (a.getIsSystemType()) {
file = new File(tempPath + a.getPath());
try {
tWorkbook = WorkbookFactory.create(file);
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidFormatException e) {
e.printStackTrace();
}
} else {
InputStream is = null;
try {
String path = "";
if (a.getPath().indexOf("/") > 0) {
path = a.getPath();
} else {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(a.getPath()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String, String> urlMap = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
path = uploadDetail.getList().get(0).getViewHttpUrl();
}
}
is = httpFileService.getUserTemplate(path);
tWorkbook = WorkbookFactory.create(is);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//处理workbook
List<AnalysisSalesValueDto> dataList = periodCellDataMapper.selectReportData(a.getTemplateId(),a.getProjectId(),a.getPeriod());
for(AnalysisSalesValueDto cellData:dataList){
Sheet sheet = tWorkbook.getSheetAt(0);
Cell cell = sheet.getRow(cellData.getRowIndex()).getCell(cellData.getColumnIndex());
sheet.getRow(cellData.getRowIndex()).removeCell(cell);
sheet.getRow(cellData.getRowIndex()).createCell(cellData.getColumnIndex());
sheet.getRow(cellData.getRowIndex()).getCell(cellData.getColumnIndex()).setCellValue(cellData.getData());
}
POIUtil.cloneSheetAndStyle(tWorkbook.getSheetAt(0), workbook.createSheet(a.getCode()),workbook);
});
return workbook;
} catch (Exception e) {
logger.error("createWorkBookByPeriodTemplate error.", e);
throw Exceptions.SERVER_ERROR_EXCEPTION;
}
}
}
/**
* 注册所有的自定义方法到工作簿
*
......
......@@ -56,6 +56,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -1309,6 +1310,7 @@ public class ReportServiceImpl extends BaseService {
CellDataDto cellDataDto = null;
CellDataDto cellDataDto1 = null;
for (int i = 0; i < list.size(); i++) {
if(i >=23) continue;//过滤掉多余数据
cellDataDto = new CellDataDto();
cellDataDto1 = new CellDataDto();
if (list.get(i).getItemName().equals(""))
......@@ -2520,38 +2522,6 @@ public class ReportServiceImpl extends BaseService {
}
@Transactional
public void saveDatasource(String orgId, Integer period, Integer specialConsiderations, String ebitRate,
OperationResultDto<ReportDataDto> operationResultDto,
List<CellDataDto> cellDataList) {
EbitCellDataExample example = null;
List<EbitCellData> ebitCellDataList = new ArrayList<>();
for (int i = 37; i <= 43; i++) {
example = new EbitCellDataExample();
EbitCellDataExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period).andColEqualTo(1).andRowEqualTo(i);
List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example);
if (ebitCellData.size() == 0) {
for (CellDataDto cellDataDto : cellDataList) {
EbitCellData ebitCellData1 = new EbitCellData();
ebitCellData1.setId(idService.nextId());
ebitCellData1.setOrganizationId(orgId);
ebitCellData1.setPeriod(period);
ebitCellData1.setCreateTime(new Date());
ebitCellData1.setCol(cellDataDto.getColumnIndex());
ebitCellData1.setRow(cellDataDto.getRowIndex());
ebitCellData1.setData(cellDataDto.getCellValue());
ebitCellDataList.add(ebitCellData1);
}
ebitCellDataList.add(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId, period));
ebitCellDataMapper.insertBatch(ebitCellDataList);
} else {
ebitCellDataMapper.updateByExampleSelective(switchMeth(i, new EbitCellData(), operationResultDto, specialConsiderations, ebitRate, orgId, period), example);
}
}
}
private EbitCellData switchMeth(Integer i, EbitCellData ebitCellData1, OperationResultDto<ReportDataDto> operationResultDto, Integer specialConsiderations, String ebitRate, String orgId, Integer period) {
switch (i) {
case 37:
......@@ -2671,6 +2641,7 @@ public class ReportServiceImpl extends BaseService {
@Autowired
private JdbcTemplate jdbcTemplate;
private CellStyle cellStyle1 = null;
private static final String EBITTemplateCode = "VAT10086";
/**
* 批量导出Excel ebit利润表
......@@ -2685,7 +2656,7 @@ public class ReportServiceImpl extends BaseService {
File templateFile;
InputStream inputStream = null;
TemplateExample templateExample = new TemplateExample();
templateExample.createCriteria().andCodeEqualTo("VAT10086").andNameEqualTo("VAT10086");//todo 这里是利润表模板的固定code,禁止重复
templateExample.createCriteria().andCodeEqualTo(EBITTemplateCode).andNameEqualTo(EBITTemplateCode);//todo 这里是利润表模板的固定code,禁止重复
List<Template> templates1 = templateMapper.selectByExample(templateExample);
if (templates1.size() == 0)
throw new Exception("没有利润表模板,无法批量导出,请上传模板");
......@@ -2885,7 +2856,9 @@ public class ReportServiceImpl extends BaseService {
sheetAt.getRow(row).getCell(col).setCellStyle(cellStyle1);
return sheetAt.getRow(row).getCell(col);
}
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);// 水平
......@@ -2949,7 +2922,7 @@ public class ReportServiceImpl extends BaseService {
//获取利润表模板Id 利润表固定模板VAT10086
public String getlxbId() throws Exception {
try {
String sql = "select * from template t where t.name = 'VAT10086' order by t.create_time desc ";
String sql = "select * from template t where t.name = '" + EBITTemplateCode + "' order by t.create_time desc ";
Map<String, Object> stringObjectMap = new HashMap<>();
stringObjectMap = jdbcTemplate.queryForList(sql).get(0);
return stringObjectMap.get("id").toString();
......
......@@ -144,7 +144,7 @@ public class TBM extends FunctionBase implements FreeRefFunction {
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1)));
}
}
amount = amount.add(dto.getAmount());
amount = amount.add(dto.getAmount()==null?(new BigDecimal(0)):dto.getAmount());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
......
......@@ -3,6 +3,8 @@ package pwc.taxtech.atms.analysis.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.entity.BaseEntity;
/**
......
......@@ -868,5 +868,6 @@
"NumOfBranches":"分公司数量",
"ConditionColumnNum": "Search Condition Column Num",
"Condition": "Search Condition",
"RevenueTypeConfiguration":"Revenue Type Config"
"RevenueTypeConfiguration":"Revenue Type Config",
"FinancialStatementsType": "Financial Statements"
}
......@@ -928,5 +928,6 @@
"ConditionColumnNum": "条件列",
"Condition": "查询条件",
"Cancel4Tax": "取消",
"FinancialStatementsType": "财务报表",
"~MustBeEndOneApp": "I Must be the End One, please!"
}
......@@ -211,7 +211,26 @@
var m = data.year.substring(0, data.year.length - 1);
$scope.fixedAssetsObject.year = m;
}
//根据当前资产的一级分类判断当前modal需要显示的标签
if (type == "1"){
$scope.assetAdd = "StandardFixedAssetsAdd";
$scope.assetEdit = "StandardFixedAssetsEdit";
$scope.assetCode = "FixedAssetsCode";
$scope.assetName = "FixedAssetsName";
$scope.assetAgeLimit = "FixedAssetsAgeLimit";
} else if(type == "2") {
$scope.assetAdd = "LongTermPendingAdd";
$scope.assetEdit = "LongTermPendingEdit";
$scope.assetCode = "LongTermPendingCode";
$scope.assetName = "LongTermPendingName";
$scope.assetAgeLimit = "LongTermPendingAgeLimit";
} else if(type == "3") {
$scope.assetAdd = "IntangibleAssetsAdd";
$scope.assetEdit = "IntangibleAssetsEdit";
$scope.assetCode = "IntangibleAssetsCode";
$scope.assetName = "IntangibleAssetsName";
$scope.assetAgeLimit = "IntangibleAssetsAgeLimit";
}
$(editModalSelector).modal('show');
};
$scope.editMapping = function (data) {
......
......@@ -519,7 +519,7 @@
rowData.taxDepreciationPeriod = null;
} else {
rowData.assetDetailGroupId = aseetDetailList[0].id;
rowData.taxDepreciationPeriod = aseetDetailList[0].groupYear;
rowData.taxDepreciationPeriod = aseetDetailList[0].groupYear * 12;
}
;
},
......@@ -543,7 +543,7 @@
return item.id == value;
});
if (aseetDetailList.length > 0) {
rowData.taxDepreciationPeriod = aseetDetailList[0].groupYear;
rowData.taxDepreciationPeriod = aseetDetailList[0].groupYear * 12;
}
},
lookup: {
......
......@@ -21,6 +21,12 @@
<input class="form-control input-width-middle" type="text" id="description" ng-model="queryParams.description" />
</td>
</tr>
<tr>
<td>
<span translate="importWay"></span>
<input class="form-control input-width-middle" type="text" id="source" ng-model="queryParams.source" />
</td>
</tr>
<tr style="display: none">
<td>
<span translate="orgCode"></span>
......
......@@ -43,6 +43,7 @@
subjectCode: null,
subjectName: null,
description: null,
source: null,
orgCode: null,
orgName: null,
documentDate: null,
......@@ -97,6 +98,7 @@
subjectCode: null,
subjectName: null,
description: null,
source: null,
orgCode: null,
orgName: null,
documentDate: null,
......
......@@ -578,7 +578,6 @@ debugger;
var tasks = JSON.parse(job.status);
if (job.jobStatus == 'End') {
items.forEach(function (item, index) {
item.status = 'completed';
......@@ -632,10 +631,11 @@ debugger;
items.forEach(function (item, index) {
item.items.forEach(function (_task, index) {
var temp = false;
tasks.forEach(function (task) {
if (task.code == _task.code) {
temp = true;
if (task.status == 'Error') {
_task.status = 'error';
} else if (task.status == 'End') {
......@@ -645,7 +645,12 @@ debugger;
}
_task.text = $translate.instant(_task.status);
}
})
});
//此时证明该code还未开始
if(!temp){
_task.status = 'unstarted';
_task.text = $translate.instant(_task.status);
}
})
});
}
......
......@@ -980,7 +980,7 @@
//批量导出EXCEL
$scope.export = function () {
debugger;
$('#busy-indicator-container').show();
var grp = _.find($scope.$parent.$parent.groups, function (g) {
return g.name == 'TaxReturnType';
});
......@@ -1028,6 +1028,7 @@ debugger;
xhr.send(JSON.stringify({
reportIds: reportIds
}));
$('#busy-indicator-container').hide();
return;
}
......@@ -1048,6 +1049,7 @@ debugger;
xhr.send(JSON.stringify({
reportIds: reportIds
}));
$('#busy-indicator-container').hide();
return;
}
......
......@@ -57,7 +57,7 @@
ng-click="downloadTemplate()"></button>
<button type="button"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;display: none"
translate="AddImportBtn"
ng-click="importFile(importEnum.AddImport)"></button>
......
......@@ -66,7 +66,8 @@ constant.citReportTypeList = [
{value: 2, name: 'QuarterlyFilingReturnType', orderIndex: 2},
{value: 3, name: 'WorkingPaperType', orderIndex: 3},
{value: 4, name: 'DocumentListType', orderIndex: 4},
{value: 5, name: 'OtherTaxes', orderIndex: 5}];
{value: 5, name: 'FinancialStatementsType', orderIndex: 5},
{value: 6, name: 'OtherTaxes', orderIndex: 6}];
constant.cfReportTypeList = [
{value: 1, name: '企业所得税预算'},
......
......@@ -1181,7 +1181,9 @@
/------------------------------------------------kevin insert -----------------------------------/
PWC.downloadCallBack = function (data, status, headers, fileName) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
var contentType = octetStreamMime;
if (headers)
contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
......@@ -1214,7 +1216,7 @@
scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
width: function() {
width: function () {
return window.innerWidth / 4.5;
},
bindingOptions: {
......@@ -1227,10 +1229,10 @@
searchEnabled: true,
noDataText: translate.instant('RevenueNoOrgData'),
showSelectionControls: true,
visible : true,
deferRendering : false
visible: true,
deferRendering: false
};
if(exp)
if (exp)
_.extend(scope.selectOrgOptions, exp);
};
......
......@@ -107,6 +107,17 @@
allowHeaderFiltering: false,
width: '15%',
caption: $translate.instant('Status')
}, {
dataField: "operator",
allowHeaderFiltering: false,
width: '10%',
caption: $translate.instant('Creator')
},{
dataField: "createTime",
dataType: "date",
format: "yyyy-MM-dd HH:mm:ss",
width: '15%',
caption: $translate.instant('OperateTime')
}
],
onContentReady: function (e) {
......
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