Commit def95670 authored by neo.wang's avatar neo.wang

Merge branch 'dev_oracle_neo' into 'dev_oracle'

Dev oracle neo

See merge request root/atms!207
parents ebf3c7d4 7e7b44b1
package pwc.taxtech.atms.vat.service.impl;
import com.google.common.collect.Lists;
import jdk.nashorn.internal.runtime.options.Option;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
......@@ -16,20 +14,16 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.dto.vatdto.PeriodResources;
import pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.MergerManaualCellData;
import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.*;
......@@ -44,7 +38,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper;
import static pwc.taxtech.atms.constant.Constant.EMPTY;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component
......@@ -517,7 +510,7 @@ public class ReportGeneratorImpl {
*/
public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext)
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext),
new JFFS(formulaContext), new WPSR(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
......
......@@ -50,7 +50,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX",
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR"};
@Autowired
......
......@@ -12,8 +12,8 @@ import pwc.taxtech.atms.vat.entity.PeriodReport;
import java.util.Calendar;
import java.util.Date;
public class ProjectContext extends FunctionBase implements FreeRefFunction {
public ProjectContext(FormulaContext formulaContext) {
public class PC extends FunctionBase implements FreeRefFunction {
public PC(FormulaContext formulaContext) {
super(formulaContext);
}
......@@ -56,13 +56,9 @@ public class ProjectContext extends FunctionBase implements FreeRefFunction {
, formulaContext.getPeriod(), calendar.get(Calendar.DAY_OF_MONTH), formulaContext.getYear()
, formulaContext.getPeriod(), calendar2.get(Calendar.DAY_OF_MONTH)));
case "FillForm":
PeriodReport report = SpringContextUtil.reportMapper.selectByPrimaryKey(formulaContext.getReportId());
if (report != null) {
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillForm, report.getUpdateTime().getYear()
, report.getUpdateTime().getMonth(), report.getUpdateTime().getDay()));
} else {
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillFormStr, " ", " ", " "));
}
Date updateDate = new Date();
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillForm, updateDate.getYear()
, updateDate.getMonth(), updateDate.getDay()));
case "TaxPayerNo":
String taxPayerNo = SpringContextUtil.organizationMapper.selectByPrimaryKey(formulaContext.getOrganizationId()).getTaxPayerNumber();
if (StringUtils.isNotBlank(taxPayerNo) && taxPayerNo.length() - 1 >= parameterInt) {
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -13,10 +14,7 @@ import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -80,16 +78,16 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
dto.setName(DataSourceName.ReportDataSource);
dto.setPeriod(formulaContext.getPeriod());
dto.setProjectId(formulaContext.getProjectId());
dto.setRowIndex(pCell.rowIndex-1);
dto.setColumnIndex(pCell.columnIndex-1);
dto.setColumnName((pCell.columnIndex)+"列");
dto.setRowName((pCell.rowIndex)+"行");
dto.setRowIndex(pCell.rowIndex - 1);
dto.setColumnIndex(pCell.columnIndex - 1);
dto.setColumnName((pCell.columnIndex) + "列");
dto.setRowName((pCell.rowIndex) + "行");
dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex()));
dto.setType( FormulaDataSourceType.Report.getCode());
dto.setType(FormulaDataSourceType.Report.getCode());
dataSource.add(dto);
bigDecimal = bigDecimal.add(cellValue);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
......
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