理财报表优化
This commit is contained in:
		
							parent
							
								
									e6dae28bf9
								
							
						
					
					
						commit
						ca6f4ff736
					
				|  | @ -161,6 +161,8 @@ public class FinancialFormReport extends AbstractReportFormPlugin implements Plu | |||
|         //ReportUtils.changeRowData(rowData,REPORT_FIELDS[0]); | ||||
|         //过滤 | ||||
|         ReportUtils.removeRowData(rowData,REPORT_FIELDS[9],DYNAMICS_FIELDS[1]); | ||||
|         //排序 | ||||
|         //ReportUtils.sortByDate(rowData,REPORT_FIELDS[9],false); | ||||
|         //添加合计 | ||||
|         // 需要配置求和的字段映射(目标字段,来源字段) | ||||
|         List<String[]> sumConfig = new ArrayList<>(); | ||||
|  | @ -176,6 +178,7 @@ public class FinancialFormReport extends AbstractReportFormPlugin implements Plu | |||
|         ReportUtils.addTotalRowData(rowData,REPORT_FIELDS[0],"小计","合计",sumConfig); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | @ -492,7 +495,7 @@ public class FinancialFormReport extends AbstractReportFormPlugin implements Plu | |||
|                 Object pkValue = shdh.getPkValue(); | ||||
|                 DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(pkValue, "cim_redeem"); | ||||
|                 BigDecimal amount = dynamicObject.getBigDecimal("amount"); // 赎回金额字段名 | ||||
|                 BigDecimal realrevenue = dynamicObject.getBigDecimal("revenueamount"); // 实际收益字段名 | ||||
|                 BigDecimal realrevenue = dynamicObject.getBigDecimal("realrevenue"); // 实际收益字段名 | ||||
|                 if (amount != null) { | ||||
|                     sum = sum.add(amount).add(realrevenue); | ||||
|                 } | ||||
|  | @ -657,6 +660,7 @@ public class FinancialFormReport extends AbstractReportFormPlugin implements Plu | |||
|                     if (maxRedeemDate != null) { | ||||
|                         endDate = maxRedeemDate; | ||||
|                         row.set(REPORT_FIELDS[9], endDate); // 设置到期日 | ||||
|                         expireDate=endDate; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  |  | |||
|  | @ -7,10 +7,7 @@ import kd.bos.entity.report.ReportColumn; | |||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Calendar; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| import java.util.*; | ||||
| 
 | ||||
| public class ReportUtils { | ||||
| 
 | ||||
|  | @ -80,6 +77,46 @@ public class ReportUtils { | |||
|         rowData.add(0,totalRow); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 根据日期字段对行数据进行排序 | ||||
|      * @param rowData 要排序的数据集合 | ||||
|      * @param dateField 日期字段名 | ||||
|      * @param descending 是否降序排序(true-降序,false-升序) | ||||
|      */ | ||||
|     public static void sortByDate(DynamicObjectCollection rowData, String dateField, boolean descending) { | ||||
|         if (rowData == null || dateField == null || rowData.isEmpty()) { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         List<DynamicObject> dataList = new ArrayList<>(rowData); | ||||
| 
 | ||||
|         Collections.sort(dataList, new Comparator<DynamicObject>() { | ||||
|             @Override | ||||
|             public int compare(DynamicObject o1, DynamicObject o2) { | ||||
|                 Date date1 = o1.getDate(dateField); | ||||
|                 Date date2 = o2.getDate(dateField); | ||||
| 
 | ||||
|                 if (date1 == null && date2 == null) { | ||||
|                     return 0; | ||||
|                 } | ||||
|                 if (date1 == null) { | ||||
|                     return descending ? 1 : -1; | ||||
|                 } | ||||
|                 if (date2 == null) { | ||||
|                     return descending ? -1 : 1; | ||||
|                 } | ||||
| 
 | ||||
|                 int comparison = date1.compareTo(date2); | ||||
|                 return descending ? -comparison : comparison; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         // 清空原集合并添加排序后的数据 | ||||
|         rowData.clear(); | ||||
|         rowData.addAll(dataList); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 对小计行处理 | ||||
|      * @param rowData 数据集合 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue