头寸表改动
This commit is contained in:
		
							parent
							
								
									72bb799fee
								
							
						
					
					
						commit
						881d15fa2f
					
				|  | @ -15,6 +15,7 @@ import java.util.Iterator; | ||||||
|  */ |  */ | ||||||
| public class BankInfoFormReport extends AbstractReportFormPlugin implements Plugin { | public class BankInfoFormReport extends AbstractReportFormPlugin implements Plugin { | ||||||
| 
 | 
 | ||||||
|  |     private static final String[] LIMIT_BANK = {"交通银行","平安银行","招商银行","中国工商银行","中国建设银行","中国农业银行","中国银行"}; | ||||||
|     private static final String[] NEED_FIELDS = { |     private static final String[] NEED_FIELDS = { | ||||||
|             "shjh_accountname", "shjh_accountnumber", "shjh_currencynumber", "shjh_bankname", |             "shjh_accountname", "shjh_accountnumber", "shjh_currencynumber", "shjh_bankname", | ||||||
|             "shjh_openbankname", "shjh_hostbankname", "shjh_hostbankbra", "shjh_accttype", |             "shjh_openbankname", "shjh_hostbankname", "shjh_hostbankbra", "shjh_accttype", | ||||||
|  | @ -42,7 +43,6 @@ public class BankInfoFormReport extends AbstractReportFormPlugin implements Plug | ||||||
|                 row.set(NEED_FIELDS[19], amount); |                 row.set(NEED_FIELDS[19], amount); | ||||||
|                 BigDecimal rate = row.getBigDecimal(NEED_FIELDS[20]); |                 BigDecimal rate = row.getBigDecimal(NEED_FIELDS[20]); | ||||||
|                 if (rate != null && rate.compareTo(BigDecimal.ZERO) != 0) { |                 if (rate != null && rate.compareTo(BigDecimal.ZERO) != 0) { | ||||||
|                     //按照最新头寸取值时间获取银行账户最后一笔交易明细中的余额*汇率 |  | ||||||
|                     BigDecimal multiply = rate.multiply(amount); |                     BigDecimal multiply = rate.multiply(amount); | ||||||
|                     row.set(NEED_FIELDS[21], multiply); |                     row.set(NEED_FIELDS[21], multiply); | ||||||
|                     row.set(NEED_FIELDS[22], multiply); |                     row.set(NEED_FIELDS[22], multiply); | ||||||
|  | @ -52,17 +52,62 @@ public class BankInfoFormReport extends AbstractReportFormPlugin implements Plug | ||||||
|                     row.set(NEED_FIELDS[26], multiply); |                     row.set(NEED_FIELDS[26], multiply); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             //【城市】:银行账户的开户行中城市名称,需要去掉“市”字 | 
 | ||||||
|             String cityName = row.getString(NEED_FIELDS[32]); |             // 1.【币种】:CNY需要转换为RMB | ||||||
|             if (cityName != null && cityName.endsWith("市")) { |             String currencyNumber = row.getString(NEED_FIELDS[2]); | ||||||
|                 cityName = cityName.substring(0, cityName.length() - 1); |             if (currencyNumber != null && currencyNumber.contains("CNY")) { | ||||||
|                 row.set(NEED_FIELDS[32],cityName); |  | ||||||
|             } |  | ||||||
|             //【币种】:CNY需要转换为RMB |  | ||||||
|             String currencyNumber= row.getString(NEED_FIELDS[2]); |  | ||||||
|             if (currencyNumber!=null && currencyNumber.contains("CNY")){ |  | ||||||
|                 row.set(NEED_FIELDS[2], currencyNumber.replace("CNY", "RMB")); |                 row.set(NEED_FIELDS[2], currencyNumber.replace("CNY", "RMB")); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             // 2.【主办行名称】:特殊处理,不在LIMIT_BANK中名称改为"其他" | ||||||
|  |             String hostBankName = row.getString(NEED_FIELDS[5]); | ||||||
|  |             if (hostBankName != null) { | ||||||
|  |                 boolean isLimitBank = false; | ||||||
|  |                 for (String bank : LIMIT_BANK) { | ||||||
|  |                     if (bank.equals(hostBankName)) { | ||||||
|  |                         isLimitBank = true; | ||||||
|  |                         break; | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 if (!isLimitBank) { | ||||||
|  |                     row.set(NEED_FIELDS[5], "其他"); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 3.【账户类型】:改为活期账户 | ||||||
|  |             row.set(NEED_FIELDS[10],"活期账户"); | ||||||
|  | 
 | ||||||
|  |             // 3.【城市】:银行账户的开户行中城市名称,需要去掉"市"字 | ||||||
|  |             String cityName = row.getString(NEED_FIELDS[31]); | ||||||
|  |             if (cityName != null && cityName.endsWith("市")) { | ||||||
|  |                 cityName = cityName.substring(0, cityName.length() - 1); | ||||||
|  |                 row.set(NEED_FIELDS[31], cityName); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 4.【是否协定存款】:有值且>0填入"是",为null或""或<=0填入"否" | ||||||
|  |             String isNotAgrDeposits = row.getString(NEED_FIELDS[32]); | ||||||
|  |             if (isNotAgrDeposits != null && !isNotAgrDeposits.isEmpty()) { | ||||||
|  |                 try { | ||||||
|  |                     double value = Double.parseDouble(isNotAgrDeposits); | ||||||
|  |                     row.set(NEED_FIELDS[32], value > 0 ? "是" : "否"); | ||||||
|  |                 } catch (NumberFormatException e) { | ||||||
|  |                     row.set(NEED_FIELDS[32], "否"); | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 row.set(NEED_FIELDS[32], "否"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 5.【是否境外账户】:境内="否",境外="是" | ||||||
|  |             String isNotOveAccounts = row.getString(NEED_FIELDS[33]); | ||||||
|  |             if (isNotOveAccounts != null) { | ||||||
|  |                 if ("A".equals(isNotOveAccounts)) { | ||||||
|  |                     row.set(NEED_FIELDS[33], "否"); | ||||||
|  |                 } else if ("B".equals(isNotOveAccounts)) { | ||||||
|  |                     row.set(NEED_FIELDS[33], "是"); | ||||||
|  |                 } | ||||||
|  |                 // 其他情况保持原值 | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -24,9 +24,9 @@ import java.util.concurrent.TimeUnit; | ||||||
| public class BankInfoListReport extends AbstractReportListDataPlugin implements Plugin { | public class BankInfoListReport extends AbstractReportListDataPlugin implements Plugin { | ||||||
| 
 | 
 | ||||||
|     private static final String[] BANK_FIELDS = { |     private static final String[] BANK_FIELDS = { | ||||||
|             "company.name","bankaccountnumber","currency.fbasedataid","bank.shjh_extname","name","bank.shjh_hostname", |             "company.name","bankaccountnumber","currency.fbasedataid","bank.bank_cate.name","bank.name","bank.shjh_hostname", | ||||||
|             "accttype","acctstatus","openorg.name","acctstyle","issetbankinterface","bank.province.name","bank.city.name", |             "accttype","acctstatus","openorg.name","acctstyle","issetbankinterface","bank.bebank.provincetxt","bank.city.name", | ||||||
|             "shjh_acctoutin","id" |             "shjh_acctoutin","id","shjh_xdlv" | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     private static final String[] DETAIL_FIELDS = { |     private static final String[] DETAIL_FIELDS = { | ||||||
|  | @ -57,10 +57,10 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|                 .append(BANK_FIELDS[1]).append(" AS ").append(NEED_FIELDS[1]).append(",") |                 .append(BANK_FIELDS[1]).append(" AS ").append(NEED_FIELDS[1]).append(",") | ||||||
|                 .append(BANK_FIELDS[3]).append(" AS ").append(NEED_FIELDS[3]).append(",") |                 .append(BANK_FIELDS[3]).append(" AS ").append(NEED_FIELDS[3]).append(",") | ||||||
|                 .append(BANK_FIELDS[4]).append(" AS ").append(NEED_FIELDS[4]).append(",") |                 .append(BANK_FIELDS[4]).append(" AS ").append(NEED_FIELDS[4]).append(",") | ||||||
|                 .append(BANK_FIELDS[5]).append(" AS ").append(NEED_FIELDS[5]).append(",") |                 .append(BANK_FIELDS[3]).append(" AS ").append(NEED_FIELDS[5]).append(",") | ||||||
|                 .append("'其他'").append(" ").append(NEED_FIELDS[6]).append(",") |                 .append("'其他'").append(" ").append(NEED_FIELDS[6]).append(",") | ||||||
|                 .append(BANK_FIELDS[6]).append(" AS ").append(NEED_FIELDS[7]).append(",") |                 .append("'收支混用户'").append(" AS ").append(NEED_FIELDS[7]).append(",") | ||||||
|                 .append(BANK_FIELDS[7]).append(" AS ").append(NEED_FIELDS[8]).append(",") |                 .append("'活动'").append(" AS ").append(NEED_FIELDS[8]).append(",") | ||||||
|                 .append(BANK_FIELDS[8]).append(" AS ").append(NEED_FIELDS[9]).append(",") |                 .append(BANK_FIELDS[8]).append(" AS ").append(NEED_FIELDS[9]).append(",") | ||||||
|                 .append(BANK_FIELDS[9]).append(" AS ").append(NEED_FIELDS[10]).append(",") |                 .append(BANK_FIELDS[9]).append(" AS ").append(NEED_FIELDS[10]).append(",") | ||||||
|                 .append("'上海家化'").append(" ").append(NEED_FIELDS[11]).append(",") |                 .append("'上海家化'").append(" ").append(NEED_FIELDS[11]).append(",") | ||||||
|  | @ -71,7 +71,7 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|                 .append(BANK_FIELDS[10]).append(" AS ").append(NEED_FIELDS[29]).append(",") |                 .append(BANK_FIELDS[10]).append(" AS ").append(NEED_FIELDS[29]).append(",") | ||||||
|                 .append(BANK_FIELDS[11]).append(" AS ").append(NEED_FIELDS[30]).append(",") |                 .append(BANK_FIELDS[11]).append(" AS ").append(NEED_FIELDS[30]).append(",") | ||||||
|                 .append(BANK_FIELDS[12]).append(" AS ").append(NEED_FIELDS[31]).append(",") |                 .append(BANK_FIELDS[12]).append(" AS ").append(NEED_FIELDS[31]).append(",") | ||||||
|                 .append("'否'").append(" ").append(NEED_FIELDS[32]).append(",") |                 .append(BANK_FIELDS[15]).append(" ").append(NEED_FIELDS[32]).append(",") | ||||||
|                 .append(BANK_FIELDS[13]).append(" AS ").append(NEED_FIELDS[33]).append(",") |                 .append(BANK_FIELDS[13]).append(" AS ").append(NEED_FIELDS[33]).append(",") | ||||||
|                 .append("'上海家化'").append(" ").append(NEED_FIELDS[34]).append(",") |                 .append("'上海家化'").append(" ").append(NEED_FIELDS[34]).append(",") | ||||||
|                 .append("'上海家化'").append(" ").append(NEED_FIELDS[35]).append(",") |                 .append("'上海家化'").append(" ").append(NEED_FIELDS[35]).append(",") | ||||||
|  | @ -95,8 +95,8 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|                     selectFields.append("'").append(accrualDate).append("'").append(" ").append(NEED_FIELDS[27]); |                     selectFields.append("'").append(accrualDate).append("'").append(" ").append(NEED_FIELDS[27]); | ||||||
|                     // 计算当前日期的下一天(用于 less_than 条件) |                     // 计算当前日期的下一天(用于 less_than 条件) | ||||||
|                     Date nextDay = new Date(filterItem.getDate().getTime() + TimeUnit.DAYS.toMillis(1)); |                     Date nextDay = new Date(filterItem.getDate().getTime() + TimeUnit.DAYS.toMillis(1)); | ||||||
|                     qFilters2.add(new QFilter("bizdate", QCP.large_equals,filterItem.getDate())); |                     qFilters2.add(new QFilter("bizdate", QCP.less_equals,filterItem.getDate())); | ||||||
|                     qFilters2.add(new QFilter("bizdate",QCP.less_than,nextDay)); |                     //qFilters2.add(new QFilter("bizdate",QCP.less_than,nextDay));//流水日期<今天0点 | ||||||
|                     break; |                     break; | ||||||
|                 case "shjh_filteraccttype": |                 case "shjh_filteraccttype": | ||||||
|                     String type = (String) filterItem.getValue(); |                     String type = (String) filterItem.getValue(); | ||||||
|  | @ -134,6 +134,11 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                         qFilters1.add(new QFilter("acctstyle", QCP.in,styleList)); |                         qFilters1.add(new QFilter("acctstyle", QCP.in,styleList)); | ||||||
|  |                     }else { | ||||||
|  |                         //仅取活期账户(一般和基本户) | ||||||
|  |                         styleList.add("basic"); | ||||||
|  |                         styleList.add("normal"); | ||||||
|  |                         qFilters1.add(new QFilter("acctstyle", QCP.in,styleList)); | ||||||
|                     } |                     } | ||||||
|                     break; |                     break; | ||||||
|                 case "shjh_bank": |                 case "shjh_bank": | ||||||
|  | @ -187,17 +192,17 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|         //收款入账中心-流水 |         //收款入账中心-流水 | ||||||
|         DataSet detailsDataSet = QueryServiceHelper.queryDataSet( |         DataSet detailsDataSet = QueryServiceHelper.queryDataSet( | ||||||
|                 this.getClass().getName() + "details", |                 this.getClass().getName() + "details", | ||||||
|                 "bei_intelrec","accountbank,biztime,transbalance AS shjh_monthamt", |                 "bei_intelrec","accountbank,bizdate,transbalance AS shjh_monthamt,modifytime AS shjh_datetimefield", | ||||||
|                 qFilters2.toArray(new QFilter[]{}), |                 qFilters2.toArray(new QFilter[]{}), | ||||||
|                 null); |                 null); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         //取最大日期 |         //取最大日期 | ||||||
|         DataSet maxDataSet=detailsDataSet.groupBy(new String[]{"accountbank"}).max("biztime").finish(); |         DataSet maxDataSet=detailsDataSet.groupBy(new String[]{"accountbank"}).max("shjh_datetimefield").finish(); | ||||||
|         //重新排序 |         //重新排序 | ||||||
|         maxDataSet=maxDataSet.join(detailsDataSet) |         maxDataSet=maxDataSet.join(detailsDataSet) | ||||||
|                 .on("accountbank","accountbank") |                 .on("accountbank","accountbank") | ||||||
|                 .select(new String[]{"accountbank","shjh_monthamt","biztime"}) |                 .on("shjh_datetimefield","shjh_datetimefield") | ||||||
|  |                 .select(new String[]{"accountbank","shjh_monthamt","bizdate","shjh_datetimefield"}) | ||||||
|                 .finish(); |                 .finish(); | ||||||
|         //过滤金额=null的数据 |         //过滤金额=null的数据 | ||||||
|         maxDataSet=maxDataSet.filter("shjh_monthamt <> null"); |         maxDataSet=maxDataSet.filter("shjh_monthamt <> null"); | ||||||
|  | @ -212,7 +217,7 @@ public class BankInfoListReport extends AbstractReportListDataPlugin implements | ||||||
|                         "shjh_fixedfield2","shjh_fixedfield3","shjh_monthamt", "shjh_exchangerate", |                         "shjh_fixedfield2","shjh_fixedfield3","shjh_monthamt", "shjh_exchangerate", | ||||||
|                         "shjh_textfield", "shjh_fixedfield4","shjh_sfzl","shjh_province","shjh_city", |                         "shjh_textfield", "shjh_fixedfield4","shjh_sfzl","shjh_province","shjh_city", | ||||||
|                         "shjh_fixedfield5", "shjh_acctoutin","shjh_fixedfield6","shjh_fixedfield7", |                         "shjh_fixedfield5", "shjh_acctoutin","shjh_fixedfield6","shjh_fixedfield7", | ||||||
|                         "shjh_fixedfield8", "shjh_fixedfield9","shjh_fixedfield10"}) |                         "shjh_fixedfield8", "shjh_fixedfield9","shjh_fixedfield10","shjh_datetimefield"}) | ||||||
|                 .finish(); |                 .finish(); | ||||||
| 
 | 
 | ||||||
|         return dataSet; |         return dataSet; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue