Commit e1f76cee authored by frank.xa.zhang's avatar frank.xa.zhang

fixed null to NumberEval.ZERO

parent 18ffb5bf
......@@ -46,7 +46,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
String accountCode, keyParam;
if (args.length < 5) {
return null;
return NumberEval.ZERO;
}
accountType = this.getIntParam(args[0], ec);
......@@ -70,7 +70,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
//标准账套
VatStandardAccount vatStandardAccount = SpringContextUtil.vatStandardAccountMapper.selectOneByAccountCode(accountCode);
if (vatStandardAccount == null) {
return null;
return NumberEval.ZERO;
}
BalanceStdManual balanceStdManual = null;
......@@ -145,7 +145,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
.getListByAccountCode(accountCode);
if (vatEnterpriseAccountList == null) {
return null;
return NumberEval.ZERO;
}
Balance balance = null;
......
......@@ -73,8 +73,8 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
if (!matchedRule.isPresent()) {
matchedRule = Optional.ofNullable(taxRuleSettings.get(0));
if (matchedRule.isPresent()) {
return null;
if (!matchedRule.isPresent()) {
return NumberEval.ZERO;
}
}
......@@ -101,6 +101,6 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
//return new NumberEval(matchedRule.get().getTaxBase());
}
return null;
return NumberEval.ZERO;
}
}
......@@ -58,12 +58,12 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
certificationPeriod = getPeriod(certificationPeriod, yearOffset);
if (yearOffset[0] < 0) {
return null;
return NumberEval.ZERO;
}
period = getPeriod(period, yearOffset);
if (yearOffset[0] < 0) {
return null;
return NumberEval.ZERO;
}
Calendar calendar = Calendar.getInstance();
......@@ -92,12 +92,12 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
inputVATInvoices = SpringContextUtil.inputVatInvoiceDao.getInputVATInvoice(period, invoiceType, null,
null, Constant.InputInvoiceCertificationResult.NotPass);
} else {
return null;
return NumberEval.ZERO;
}
if (certificationPeriod != -99 && certificationPeriod != 99
&& (certificationPeriod < 1 || certificationPeriod > 12)) {
return null;
return NumberEval.ZERO;
} else if (!formulaContext.getIsYear()) {
if (certificationPeriod == -99) {
calendar.set(formulaContext.getYear(), formulaContext.getPeriod(), 1);
......@@ -162,6 +162,6 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
saveFormulaBlock(period, ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId);
return new NumberEval(val);
}
return null;
return NumberEval.ZERO;
}
}
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
/// <summary>
/// 名称:进项发票明细
/// 功能:从发票取数,一般取发票金额或税额汇总数
/// </summary>
/// <param name="taxRate">税率——取值为17%,13%,11%,6%, 5%,3%,1.5%, 其他(其他表示除了17%,13%,11%,6%,5%,3%的税率)</param>
/// <param name="goodsName">货物名称——精确匹配引号中的值,99代表所有值(包括空值)</param>
/// <param name="amountType">取值——两种取值结果“金额” 0 和“税额” 1</param>
/// <param name="period">会计期间——三种取值结果 “-1”指上期,“0”当期,“99”当前累计(从期初到目前)</param>
/// <returns></returns>
public class JXFPMX extends FunctionBase implements FreeRefFunction {
public JXFPMX(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
if (args.length < 4) {
return null;
}
String taxRate = getStringParam(args[0], ec);
String goodsName = getStringParam(args[1], ec);
int amountType = getIntParam(args[2], ec);
int period = getIntParam(args[3], ec);
String formulaExpression = "JXFPMX(\"" + taxRate + "\",\"" + goodsName + "\","
+ amountType + "," + period + ")";
logger.debug(formulaExpression);
return NumberEval.ZERO;
}
}
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
......@@ -34,7 +35,7 @@ public class SGSR implements FreeRefFunction {
} else if (valueEvals.length == 4) {
year = 0;
} else {
return null;
return NumberEval.ZERO;
}
ValueEval v1 = OperandResolver.getSingleValue(valueEvals[0],
......@@ -68,7 +69,7 @@ public class SGSR implements FreeRefFunction {
curYear = FormulaHelper.getYear(year, formulaContext);
curPeriod = 0;
} else {
return null;
return NumberEval.ZERO;
}
List<CellTemplatePerGroupDto> cellTemplatePerGroupDtoList = SpringContextUtil.periodTemplateMapper
......@@ -82,7 +83,7 @@ public class SGSR implements FreeRefFunction {
.findFirst();
if (cellTemplatePerGroupDto == null) {
return null;
return NumberEval.ZERO;
}
//配置的行号列号都比 DB 中+1
......@@ -93,6 +94,6 @@ public class SGSR implements FreeRefFunction {
} catch (EvaluationException e) {
e.printStackTrace();
}
return null;
return NumberEval.ZERO;
}
}
......@@ -58,14 +58,14 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
if (taxRate.equals("99")) {
taxRateVal = new BigDecimal("99");
} else {
return null;
return NumberEval.ZERO;
}
} else {
taxRate = StringUtils.removeEnd(taxRate, "%");
try {
taxRateVal = BigDecimal.valueOf(Double.parseDouble(taxRate));
} catch (NumberFormatException ex) {
return null;
return NumberEval.ZERO;
}
taxRateVal = taxRateVal.divide(new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP); //保留两位小数,然后四舍五入
}
......@@ -124,6 +124,6 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId);
return new NumberEval(val);
}
return null;
return NumberEval.ZERO;
}
}
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