|
@@ -90,9 +90,9 @@ public class BudgetListener extends AnalysisEventListener<Budget> {
|
|
|
System.out.println(list.size()+"条数据,开始存储数据库!");
|
|
|
|
|
|
String[] keys={"getJanuary","getFebruary","getMarch","getApril","getMay","getJune","getJuly","getAugust","getSeptember","getOctober","getNovember","getDecember"};
|
|
|
- String totalYearYs="0";
|
|
|
+ String totalYearYs=null;
|
|
|
for (Budget budget:list){
|
|
|
- String totalYs="0";
|
|
|
+ String totalYs=null;
|
|
|
String kmdl=budget.getProject().split("-")[0];
|
|
|
String kmmc=budget.getProject();
|
|
|
for (int i = 0; i < 12; i++) {
|
|
@@ -100,20 +100,21 @@ public class BudgetListener extends AnalysisEventListener<Budget> {
|
|
|
String yearMonthStr=date.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
String yearMonth= String.valueOf(date.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
|
|
String data=ReflectUtil.invoke(budget, keys[i]);
|
|
|
- if(data!=null&&!data.equals("")){
|
|
|
+ if(data!=null&&!data.equals("")&&!data.equals("-")){
|
|
|
+ data=data.replaceAll(",","");
|
|
|
System.out.println("月份:"+i+"科目编码:"+budget.getKmbm()+"数据值:"+data);
|
|
|
- totalYs= NumberUtil.add(totalYs,data.replaceAll(",","")).toString();
|
|
|
+ totalYs= NumberUtil.add((totalYs==null?"0":totalYs),data).toString();
|
|
|
saveYearAndKmbmAndMonth(data,budget.getKmbm(),yearMonth,yearMonthStr,kmdl,kmmc);
|
|
|
}
|
|
|
}
|
|
|
- totalYearYs= NumberUtil.add(totalYearYs,totalYs).toString();
|
|
|
-// if(!totalYs.equals("0")){
|
|
|
+ if(totalYs!=null){
|
|
|
+ totalYearYs= NumberUtil.add((totalYearYs==null?"0":totalYearYs),totalYs).toString();
|
|
|
saveYearAndKmbm(totalYs,budget.getKmbm(),kmdl,kmmc);
|
|
|
-// }
|
|
|
+ }
|
|
|
}
|
|
|
-// if(!totalYearYs.equals("0")){
|
|
|
+ if(totalYearYs!=null){
|
|
|
saveYear(totalYearYs);
|
|
|
-// }
|
|
|
+ }
|
|
|
System.out.println("存储数据库成功!");
|
|
|
}
|
|
|
|