Commit 310468b7 authored by kevin's avatar kevin

#

parent 5d9addb7
...@@ -174,7 +174,7 @@ public class FormulaAgent { ...@@ -174,7 +174,7 @@ public class FormulaAgent {
public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool) throws Exception { public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, String year, boolean bool) throws Exception {
String sql = "select sum (" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue; String sql = "select sum(" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue;
String _p = insertZero(formulaContext.getPeriod() - Math.abs(period)); String _p = insertZero(formulaContext.getPeriod() - Math.abs(period));
String _period = insertZero(formulaContext.getPeriod()); String _period = insertZero(formulaContext.getPeriod());
String per = insertZero((formulaContext.getPeriod() - 1)); String per = insertZero((formulaContext.getPeriod() - 1));
...@@ -218,9 +218,8 @@ public class FormulaAgent { ...@@ -218,9 +218,8 @@ public class FormulaAgent {
formulaAgent.getTableDataByName("CIT_TBAM", "ending_balance", "attribute", "= '销售费用-财产损耗、盘亏及毁损损失'", 0, "2018", formulaContext); formulaAgent.getTableDataByName("CIT_TBAM", "ending_balance", "attribute", "= '销售费用-财产损耗、盘亏及毁损损失'", 0, "2018", formulaContext);
} }
public double getTableDataByName(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) { public BigDecimal getTableDataByName(String tableName, String getField, String filter, String filterValue, Integer period, String year, FormulaContext formulaContext) {
Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext)); Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext));
double rev = 0.00;
/* for (int i = 0, j = stringObjectMap.size(); i < j; i++) { /* for (int i = 0, j = stringObjectMap.size(); i < j; i++) {
if (i == 1) { if (i == 1) {
if(stringObjectMap.get(i).get(StringUtil.underline2Camel(getField)) == null){ if(stringObjectMap.get(i).get(StringUtil.underline2Camel(getField)) == null){
...@@ -238,9 +237,9 @@ public class FormulaAgent { ...@@ -238,9 +237,9 @@ public class FormulaAgent {
} }
} }
*/ */
if(stringObjectMap.get(StringUtil.underline2Camel(getField)) != null ){ if(stringObjectMap.get(getField) != null ){
return (double)stringObjectMap.get(StringUtil.underline2Camel(getField)); return new BigDecimal(stringObjectMap.get(getField).toString());
} }
return rev; return new BigDecimal(0);
} }
} }
...@@ -56,7 +56,7 @@ public class TABLESUMIF extends FunctionBase implements FreeRefFunction { ...@@ -56,7 +56,7 @@ public class TABLESUMIF extends FunctionBase implements FreeRefFunction {
String filterValue =resolverString(args, ec, 3); String filterValue =resolverString(args, ec, 3);
period = resolverInteger(args, ec, 4);//会计期间 period = resolverInteger(args, ec, 4);//会计期间
year = resolverString(args, ec, 5);//会计年度 year = resolverString(args, ec, 5);//会计年度
new NumberEval(agent.getTableDataByName(tableName, getField,filter,filterValue, period, year, formulaContext)); new NumberEval(agent.getTableDataByName(tableName, getField,filter,filterValue, period, year, formulaContext).doubleValue());
} catch (EvaluationException e) { } catch (EvaluationException e) {
e.printStackTrace(); e.printStackTrace();
return new NumberEval(0.00); return new NumberEval(0.00);
......
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