diff --git a/calc/com/tenwa/reckon/product/ProductCondition.java b/calc/com/tenwa/reckon/product/ProductCondition.java index 7a3583afc..6e83baa2d 100644 --- a/calc/com/tenwa/reckon/product/ProductCondition.java +++ b/calc/com/tenwa/reckon/product/ProductCondition.java @@ -8,6 +8,7 @@ import java.util.Map.Entry; import java.util.Vector; import jbo.sys.CODE_LIBRARY; +import apx.com.amarsoft.als.apzl.apply.business.loan.product.ProductBaseLoanTools; import com.amarsoft.app.als.sys.tools.DateUtil; import com.amarsoft.app.awe.config.InitDBType; @@ -47,6 +48,24 @@ public class ProductCondition { return sb.toString(); } + public String getProductRulesApp(List> appList,String productId,Vector vali) throws Exception{ + ProductBaseLoanTools.addAppList(appList, "LEASE_AMT_DATE", "coldefaultvalue", DateUtil.getToday()); + StringBuilder sb=new StringBuilder(); + sb.append("{"); + sb.append("'fund':"+this.getProductFundRulesApp(appList, productId,vali));//资金配置项 + sb.append(",'grace':"+this.getProductGraceRulesApp(appList, productId, vali));//宽限期 + sb.append(",'method':"+this.getProductSettleRulesApp(appList, productId));//计算方式 + sb.append("}"); + setRentOrRateApp(appList, productId);//租金推算方法 + this.getOtherRuleApp(appList, productId);//其它配置 + this.getProductPenaRulesApp(appList, productId);//罚息 + this.getProductAdjustRulesApp(appList, productId);//调息 + this.getGrossRulesApp(appList, productId);// +// this.setDateRule(doTemp, productId);//日期 + this.getCautionRatioApp(appList, productId);//保证金比例 + return sb.toString(); + } + /** * 设置日期 * @param doTemp @@ -109,6 +128,91 @@ public class ProductCondition { } } + public void setDateRuleApp(List> appList,String productId) throws Exception{ + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0340"); + Map PLAN_DATE_HOILDAY = new HashMap(); + PLAN_DATE_HOILDAY.put("colname", "PLAN_DATE_HOILDAY"); + Map FIRST_PLAN_DATE = new HashMap(); + FIRST_PLAN_DATE.put("colname", "FIRST_PLAN_DATE"); + Map LAST_PLAN_DATE = new HashMap(); + LAST_PLAN_DATE.put("colname", "LAST_PLAN_DATE"); + Map INTEREST_DATE_HOLIDAY = new HashMap(); + INTEREST_DATE_HOLIDAY.put("colname", "INTEREST_DATE_HOLIDAY"); + Map FIRST_INTEREST_DATE = new HashMap(); + FIRST_INTEREST_DATE.put("colname", "INTEREST_DATE_HOLIDAY"); + Map LAST_INTEREST_DATA = new HashMap(); + LAST_INTEREST_DATA.put("colname", "LAST_INTEREST_DATA"); + Map RATE = new HashMap(); + Map ADDITIONAL_RATE = new HashMap(); + RATE.put("colname", "RATE"); + ADDITIONAL_RATE.put("colname", "ADDITIONAL_RATE"); + if(map.containsKey("PaymentDate")){//还款日 + Map plandatemap=map.get("PaymentDate"); + if(plandatemap.containsKey("HolidayAdjust")){ + PLAN_DATE_HOILDAY.put("coldefaultvalue", plandatemap.get("HolidayAdjust")); + appList.add(PLAN_DATE_HOILDAY); + }else{ + PLAN_DATE_HOILDAY.put("coldefaultvalue", "unchanged"); + appList.add(PLAN_DATE_HOILDAY); + } + if(plandatemap.containsKey("date_proc")){ + String s=plandatemap.get("date_proc"); + if(s.indexOf("1")>=0){ + FIRST_PLAN_DATE.put("colvisible", "1"); + FIRST_PLAN_DATE.put("colrequired", "1"); + appList.add(FIRST_PLAN_DATE); + } + if(s.indexOf("2")>=0){ + LAST_PLAN_DATE.put("colvisible", "1"); + LAST_PLAN_DATE.put("colrequired", "1"); + appList.add(LAST_PLAN_DATE); + } + if(s.indexOf("3")>=0){ + PLAN_DATE_HOILDAY.put("colvisible", "1"); + PLAN_DATE_HOILDAY.put("colrequired", "1"); + appList.add(PLAN_DATE_HOILDAY); + } + } + } + + if(map.containsKey("InterestDate")){//计息日 + Map plandatemap=map.get("InterestDate"); + if(plandatemap.containsKey("HolidayAdjust")){ + INTEREST_DATE_HOLIDAY.put("coldefaultvalue", plandatemap.get("HolidayAdjust")); + appList.add(INTEREST_DATE_HOLIDAY); + }else{ + INTEREST_DATE_HOLIDAY.put("coldefaultvalue", "unchanged"); + appList.add(INTEREST_DATE_HOLIDAY); + } + if(plandatemap.containsKey("date_proc")){ + String s=plandatemap.get("date_proc"); + if(s.indexOf("1")>=0){ + + FIRST_INTEREST_DATE.put("colvisible", "1"); + FIRST_INTEREST_DATE.put("colrequired", "1"); + appList.add(FIRST_INTEREST_DATE); + } + if(s.indexOf("2")>=0){ + LAST_INTEREST_DATA.put("colvisible", "1"); + LAST_INTEREST_DATA.put("colrequired", "1"); + appList.add(LAST_INTEREST_DATA); + } + if(s.indexOf("3")>=0){ + INTEREST_DATE_HOLIDAY.put("colvisible", "1"); + INTEREST_DATE_HOLIDAY.put("colrequired", "1"); + appList.add(INTEREST_DATE_HOLIDAY); + } + + } + } + if(map.containsKey("RateInfo")){ + RATE.put("coldefaultvalue", map.get("RateInfo").get("RATE")); + ADDITIONAL_RATE.put("coldefaultvalue", map.get("RateInfo").get("AdditionalRate")); + appList.add(RATE); + appList.add(ADDITIONAL_RATE); + } + } + /** * 项目粗利 净融资额 期初付款总计 是否显示 * @param doTemp @@ -128,6 +232,20 @@ public class ProductCondition { doTemp.setVisible("FIRST_PAYMENT_TOTAL",false); } } + + public void getGrossRulesApp(List> appList,String productId) throws Exception{ + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0330"); + if(!map.containsKey("GrossProfit")){ + ProductBaseLoanTools.addAppList(appList, "GROSS_PROFIT", "colvisible", "0"); + } + if(!map.containsKey("CleanCreditMoney")){ + ProductBaseLoanTools.addAppList(appList, "CLEAN_CREDIT_MONEY", "colvisible", "0"); + ProductBaseLoanTools.addAppList(appList, "CLEAN_CREDIT_RATIO", "colvisible", "0"); + } + if(!map.containsKey("PeriodBeginPayMoney")){ + ProductBaseLoanTools.addAppList(appList, "FIRST_PAYMENT_TOTAL", "colvisible", "0"); + } + } /** * 设置租金推算方法 下拉选项 @@ -151,6 +269,25 @@ public class ProductCondition { } + + public void setRentOrRateApp(List> appList,String productId) throws Exception{ + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0310"); + if(map.containsKey("ROR01")){ + if(map.get("ROR01").get("RentOrRate").length()>0){ + String[] rule=map.get("ROR01").get("RentOrRate").split(","); + String s=""; + for(int i=0;i0){s+=",";} + s+="'"+rule[i]+"'"; + } + ProductBaseLoanTools.addAppList(appList, "RENT_OR_RATE", "coleditsource", "jbo.sys.CODE_LIBRARY," + + "itemno,itemname,codeno='rent_or_rate' and itemno in ("+s+") order by sortno"); + } + } + + + } + /** * 获取产品配置的资金项 * @param productId @@ -258,6 +395,78 @@ public class ProductCondition { sb.append("}"); return sb.toString(); } + + @SuppressWarnings("unchecked") + public String getProductFundRulesApp(List> appList,String productId,Vector vali) throws Exception{ + StringBuilder sb=new StringBuilder(); + sb.append("{"); + //获取产品资金项 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0315"); + //获取需要和产品关联的资金项 + String sql = "codeno='FeeType' and relativecode is not null and relativecode<>''"; + List feeList=JBOFactory.createBizObjectQuery(CODE_LIBRARY.CLASS_NAME,sql).getResultList(false); + String rule=""; + Map _FINA = new HashMap(); + for(BizObject fee:feeList){ + rule=""; + String col=fee.getAttribute("relativecode").getString();//费用项在表中的字段 + String colName=fee.getAttribute("itemname").getString();//费用名称 + String isFina=fee.getAttribute("attribute2").getString();//是否参与融资 + String fina = ProductParamUtil.getProductParameterValue(productId, "PRD0315",col,"FINAN"); + String cautionMoneymethod = ProductParamUtil.getProductParameterValue(productId, "PRD0315",col,"DepositStyle"); + if(!"".equals(cautionMoneymethod)&&cautionMoneymethod!=null){ + ProductBaseLoanTools.addAppList(appList, "CAUTION_MONEY_METHOD", "coldefaultvalue", cautionMoneymethod); + } + + if("Y".equals(fina)){ + fina = "finatype02"; + }else { + fina = "finatype01"; + } + if(fee.getAttribute("itemno").getString().equals("feetype10")){ + rule=prodSer.getEquipRuleApp(appList, map,col,vali); + }else{ + if(map.containsKey(col)){//产品配置了该费用项 + rule=prodSer.getFeeRuleApp(appList, map, col,colName,vali); + ProductBaseLoanTools.addAppList(appList, col+"_FINA", "coldefaultvalue", fina); + }else{ + if("FINA".equals(isFina)){ + ProductBaseLoanTools.addAppList(appList, col+"_FINA", "colvisible", "0"); + } + ProductBaseLoanTools.addAppList(appList, col, "colvisible", "0"); + + if(fee.getAttribute("itemno").getString().equals("feetype2")){ + ProductBaseLoanTools.addAppList(appList, "CAUTION_DEDUCTION_MONEY", "colvisible", "0"); + ProductBaseLoanTools.addAppList(appList, "CAUTION_MONEY_REMAIN", "colvisible", "0"); + ProductBaseLoanTools.addAppList(appList, "CAUTION_MONEY_METHOD", "colvisible", "0"); + ProductBaseLoanTools.addAppList(appList, "CAUTION_MONEY_METHOD", "colrequired", "0"); + } + if("FINAL_PAYMENT".equals(col)) { + Map _METHOD = new HashMap(); + _METHOD.put("colname", col+"_METHOD"); + _METHOD.put("colvisible", "0"); + _METHOD.put("colrequired", "0"); + appList.add(_METHOD); + } + rule=null; + } + } + if(rule!=null){ + if(sb.length()>1){sb.append(",");} + sb.append("'"+col+"':"+rule+""); + } + } + for(String key:map.keySet()){ + if(key.toUpperCase().indexOf("FEETYPE")>=0){ + rule=prodSer.getFeeRuleApp(appList, map, key,map.get(key).get("colheader"),vali); + if(sb.length()>1){sb.append(",");} + sb.append("'"+key.toUpperCase()+"':"+rule+""); + } + } + sb.append("}"); + return sb.toString(); + } + /** * 宽限期最大值 * @param doTemp @@ -286,6 +495,27 @@ public class ProductCondition { } return FileOperatorUtil.getMapToJsonStr(rule); } + + public String getProductGraceRulesApp(List> appList,String productId,Vector vali) throws Exception{ + + Map rule=new HashMap(); + //获取产品其它 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0311"); + if(map.isEmpty()){ + ProductBaseLoanTools.addAppList(appList, "GRACE", "colvisible", "0"); + }else if(map.containsKey("LT01")&&map.get("LT01").containsKey("isleaseterm")&&"N".equals(map.get("LT01").get("isleaseterm"))){ + ProductBaseLoanTools.addAppList(appList, "GRACE", "colvisible", "0"); + }else{ + if(map.containsKey("LT01")){ + String max=StringUtil.nullToString(map.get("LT01").get("leaseterm-MAX")); + if(max.length()>0){ + rule.put("max","宽限期最大"+max+"期@<="); + } + } + } + return FileOperatorUtil.getMapToJsonStr(rule); + } + /** * 设置 第一期还款计划 第二期还款计划 期末余值 是否显示 * @param doTemp @@ -305,6 +535,21 @@ public class ProductCondition { } } + + public void getOtherRuleApp(List> appList,String productId) throws Exception{ + + String[] param={"EQUIP_END_VALUE"}; + //获取产品其它 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0311"); + for(int i=0;i> appList,String productId) throws Exception{ + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0308"); + if(map.containsKey("PFD01")){//免罚息天数 + String day=map.get("PFD01").get("PenaltyFreeDays"); + if(day.length()>0){ + ProductBaseLoanTools.addAppList(appList, "FREE_DEFA_INTER_DAY", "coldefaultvalue", day); + } + if("N".equals(map.get("PFD01").get("AllowModify"))){ + ProductBaseLoanTools.addAppList(appList, "FREE_DEFA_INTER_DAY", "colreadonly", "1"); + } + } + if(map.containsKey("PENALTY_RATE_DAY")){//罚息日利率 + String rate=map.get("PENALTY_RATE_DAY").get("PENALTY_RATE_DAY"); + if(rate.length()>0){ + ProductBaseLoanTools.addAppList(appList, "PENA_RATE", "coldefaultvalue", rate); + } + if("N".equals(map.get("PENALTY_RATE_DAY").get("AllowModify"))){ + ProductBaseLoanTools.addAppList(appList, "PENA_RATE", "colreadonly", "1"); + } + } + } + /** * 设置调息规则 * @param doTemp @@ -363,6 +631,19 @@ public class ProductCondition { } } } + + public void getProductAdjustRulesApp(List> appList,String productId) throws Exception{ + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0320"); + if(map.containsKey("ADJUST_INTEREST")){ + Map rule=map.get("ADJUST_INTEREST"); + if(null != rule.get("rate_float_type") && null != rule.get("adjust_style")) { + //调息方式 + ProductBaseLoanTools.addAppList(appList, "ADJUST_TYPE", "coldefaultvalue", rule.get("rate_float_type")); + //调息生效节点 + ProductBaseLoanTools.addAppList(appList, "ADJUST_STYLE", "coldefaultvalue", rule.get("adjust_style")); + } + } + } /** * 设置计算方式 * @param doTemp @@ -435,6 +716,71 @@ public class ProductCondition { return "{"+sJson+"}"; } + + public String getProductSettleRulesApp(List> appList,String productId) throws Exception{ + + //租金计算方式 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0301"); + //分段 + Map> submap=ProductParamUtil.getProductComponentType(productId, "PRD0321"); + String s=""; + + String sJson=""; + for(Map.Entry> entry:map.entrySet()){ + if(s.length()>0)s+=","; + s+="'"+entry.getKey()+"'"; + if(sJson.length()>0)sJson+=","; + sJson+="'"+entry.getKey()+"':"+FileOperatorUtil.getMapToJsonStr(entry.getValue()); + String coldefaultvalue = ""; + for (Map app : appList) { + String colName = app.get("colname") == null ? "" : app.get("colname").toString(); + if ("SETTLE_METHOD".equals(colName)) { + coldefaultvalue = app.get("coldefaultvalue") == null ? "" : app.get("coldefaultvalue").toString(); + break; + } + } + if(entry.getKey().equals(coldefaultvalue)){ + Map values=entry.getValue(); + if(values.containsKey("HolidayAdjust")){ + ProductBaseLoanTools.addAppList(appList, "PLAN_DATE_HOILDAY", "coldefaultvalue", values.get("HolidayAdjust")); + } + if(values.containsKey("InterestHolidayAdjust")){ + ProductBaseLoanTools.addAppList(appList, "INTEREST_DATE_HOLIDAY", "coldefaultvalue", values.get("InterestHolidayAdjust")); + } + if(values.containsKey("RATE")){ + ProductBaseLoanTools.addAppList(appList, "RATE", "coldefaultvalue", values.get("RATE")); + } + if(values.containsKey("AdditionalRate")){ + ProductBaseLoanTools.addAppList(appList, "ADDITIONAL_RATE", "coldefaultvalue", values.get("AdditionalRate")); + } + if(values.containsKey("InterestDayType")){ + ProductBaseLoanTools.addAppList(appList, "INTEREST_DAY_TYPE", "coldefaultvalue", values.get("InterestDayType")); + } + } + //是按起租日计算的情况,直接读取当前日期 + Map valMap = entry.getValue(); + for(Entry val : valMap.entrySet()) { + if("DefaultDueDay".equals(val.getKey())) { + if(!"02".equals(val.getValue())) { + sJson = sJson.replaceAll("}", ",ActualDay:" + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "}"); + ProductBaseLoanTools.addAppList(appList, "DefaultDueDay", "colvisible", "0"); + ProductBaseLoanTools.addAppList(appList, "DefaultDueDay", "colrequired", "0"); + } + break; + } + } + } + if(submap.containsKey("ISSUBSECTION")){ + if(s.length()>0)s+=","; + s+="'even_subsection'"; + } + ProductBaseLoanTools.addAppList(appList, "SETTLE_METHOD", "colreadonly", "1"); + ProductBaseLoanTools.addAppList(appList, "SETTLE_METHOD", "coleditsource", "jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='settle_method' and itemno in ("+s+") order by sortno"); + ProductBaseLoanTools.addAppList(appList, "coldefaultvalue", "colreadonly", s.replaceAll("'", "")); + + return "{"+sJson+"}"; + } + /** * 获取产品 资金类型 配置 添加列 * @param doTemp @@ -455,6 +801,28 @@ public class ProductCondition { } } } + /** + * + * APP + * 获取产品 资金类型 配置 添加列 + * @param doTemp + * @param productId + * @return + * @throws Exception + */ + public void getProductFundRulesApp(List> appList, String productId) throws Exception{ + //获取产品资金项 + Map> map=ProductParamUtil.getProductComponentType(productId, "PRD0315"); + for(String key:map.keySet()){ + if(!("EQUIP_AMT".equals(key)||"FIRST_PAYMENT".equals(key))){//设备款和首付款不管 + if("feetype_test".equals(key)){//测试费用 + this.prodSer.createFeeColRatioApp(appList, key, map.get(key)); + this.prodSer.createFeeColApp(appList, key, map.get(key)); + } + } + } + } + public String getSqlWhere(String condition){ String[] conds=condition.split(","); String s=""; @@ -488,4 +856,27 @@ public class ProductCondition { doTemp.setDefaultValue("YEAR_RATE",YEAR_RATE); } } + + public void getCautionRatioApp(List> appList, String productId) throws Exception{ + //测算年利率字段 + Map> productRates = ProductParamUtil.getProductComponentType(productId, "PRD0350"); + Map productRate = productRates.get("product_rate"); + if(productRate != null) { + String incomeNumber = productRate.get("INCOME_NUMBER") == null ? "0" : productRate.get("INCOME_NUMBER"); + ProductBaseLoanTools.addAppList(appList, "INCOME_NUMBER", "coldefaultvalue", incomeNumber); + String periodType = productRate.get("begin_end") == null ? "period_type_0" : productRate.get("begin_end"); + ProductBaseLoanTools.addAppList(appList, "PERIOD_TYPE", "coldefaultvalue", periodType); + String ProductType = productRate.get("ProductType") == null ? "0" : productRate.get("ProductType"); + String isReadOnly = productRate.get("ProductRateReadOnly") == null ? "Y" : productRate.get("ProductRateReadOnly"); + String YEAR_RATE = productRate.get("ProductRate") == null ? "0" : productRate.get("ProductRate"); + //利率为0,费率为1 + if("1".equals(ProductType)){ + ProductBaseLoanTools.addAppList(appList, "YEAR_RATE", "colheader", "测算费率"); + } + if("Y".equals(isReadOnly)){ + ProductBaseLoanTools.addAppList(appList, "YEAR_RATE", "colreadyonly", "1"); + } + ProductBaseLoanTools.addAppList(appList, "YEAR_RATE", "coldefaultvalue", YEAR_RATE); + } + } } diff --git a/calc/com/tenwa/reckon/product/ProductConditionService.java b/calc/com/tenwa/reckon/product/ProductConditionService.java index 48e99d02a..e2d0601b1 100644 --- a/calc/com/tenwa/reckon/product/ProductConditionService.java +++ b/calc/com/tenwa/reckon/product/ProductConditionService.java @@ -1,9 +1,14 @@ package com.tenwa.reckon.product; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Vector; +import apx.com.amarsoft.als.apzl.apply.business.loan.product.ProductBaseLoanTools; +import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache; + +import com.amarsoft.are.ARE; import com.amarsoft.awe.dw.ASColumn; import com.amarsoft.awe.dw.ASObjectModel; import com.amarsoft.awe.dw.ui.validator.ValidateRule; @@ -42,6 +47,31 @@ public class ProductConditionService { } return FileOperatorUtil.getMapToJsonStr(rule); } + + //获取设备款 产品配置 + public String getEquipRuleApp(List> appList,Map> map,String col,Vector vali) throws Exception{ + Map rule=new HashMap(); + if(map.containsKey(col)){ + String min=StringUtil.nullToString(map.get(col).get("CostType08-MIN"));//最小值 + String max=StringUtil.nullToString(map.get(col).get("CostType08-MAX"));//最大值 + String defaultValue=StringUtil.nullToString(map.get(col).get("CostType08"));//限定值 + if(min.length()>0){ + rule.put("min", "设备款不能小于"+min+"@>="); + } + if(max.length()>0){ + rule.put("max", "设备款不能小于"+max+"@<="); + } + + if(defaultValue.length()>0){ + ProductBaseLoanTools.addAppList(appList, col, "coldefaultvalue", defaultValue); + ProductBaseLoanTools.addAppList(appList, col, "colreadonly", "1"); + } + }else{ + rule.put("0", "设备款必须大于0@>"); + } + ProductBaseLoanTools.addAppList(appList, col, "colvalidat", rule); + return FileOperatorUtil.getMapToJsonStr(rule); + } //获取除设备款外其它费用项 配置 public String getFeeRule(ASObjectModel doTemp,Map> map,String col,String colName,Vector vali)throws Exception{ //CostType05 是否显示比例 CostType06 输入方式 CostType07 比例参照 CostType08 金额限定 CostType09 比例限定 @@ -142,6 +172,135 @@ public class ProductConditionService { return "{"+sJson+"}"; } + @SuppressWarnings("unchecked") + public String getFeeRuleApp(List> appList,Map> map,String col,String colName,Vector vali)throws Exception{ + //CostType05 是否显示比例 CostType06 输入方式 CostType07 比例参照 CostType08 金额限定 CostType09 比例限定 + Map rule=new HashMap(); + Map ratioRule=new HashMap(); + Map aweDo = AppAweDoCache.getAppAweDoCachePool(); + Map doTemplate = null; + List> doLibrary = null; + try { + doTemplate = (Map) aweDo.get("LoanSimulationBasicInfoApp"); + doLibrary = (List>) doTemplate.get("library"); + } catch (Exception e) { + ARE.getLog().error(e); + return ""; + } + String sontno2 = ""; + + String sontno3 = ""; + String sontno4 = ""; + String sontno5 = ""; + String groupId = ""; + for (Map colM2 : doLibrary) { + String colName2 = colM2.get("colname") == null ? "" : colM2.get("colname").toString(); + if (col.equalsIgnoreCase(colName2)) { + sontno2 = colM2.get("sortno") == null ? "" : colM2.get("sortno").toString(); + groupId = colM2.get("groupid") == null ? "" : colM2.get("groupid").toString(); + } + + if ("CAUTION_DEDUCTION_MONEY".equalsIgnoreCase(colName2)) sontno3 = colM2.get("sortno") == null ? "" : colM2.get("sortno").toString(); + if ("CAUTION_MONEY_REMAIN".equalsIgnoreCase(colName2)) sontno4 = colM2.get("sortno") == null ? "" : colM2.get("sortno").toString(); + if ("CAUTION_MONEY_METHOD".equalsIgnoreCase(colName2)) sontno5 = colM2.get("sortno") == null ? "" : colM2.get("sortno").toString(); + } + String sJson=""; + if(map.containsKey(col)){ + String min=StringUtil.nullToString(map.get(col).get("CostType08-MIN"));//最小值 + String max=StringUtil.nullToString(map.get(col).get("CostType08-MAX"));//最大值 + String defaultValue=StringUtil.nullToString(map.get(col).get("CostType08"));//限定值 + String isShowRatio=StringUtil.nullToString(map.get(col).get("CostType05"));//是否显示比例 + String inputModel=StringUtil.nullToString(map.get(col).get("CostType06"));//输入方式 + String oder=StringUtil.nullToString(map.get(col).get("DISPLAY_ORDER"));//排序号 + if(!col.equals("FIRST_PAYMENT")){ + ProductBaseLoanTools.addAppList(appList, col, "sortno", oder+sontno2); + if(col.equals("CAUTION_MONEY")){ + Map CAUTION_DEDUCTION_MONEY = new HashMap(); + CAUTION_DEDUCTION_MONEY.put("colname", "CAUTION_DEDUCTION_MONEY"); + appList.add(CAUTION_DEDUCTION_MONEY); + ProductBaseLoanTools.addAppList(appList, CAUTION_DEDUCTION_MONEY.get("colname").toString(), "sortno", oder+sontno3); + Map CAUTION_MONEY_REMAIN = new HashMap(); + CAUTION_MONEY_REMAIN.put("colname", "CAUTION_MONEY_REMAIN"); + appList.add(CAUTION_MONEY_REMAIN); + ProductBaseLoanTools.addAppList(appList, CAUTION_MONEY_REMAIN.get("colname").toString(), "sortno", oder+sontno4); + Map CAUTION_MONEY_METHOD = new HashMap(); + CAUTION_MONEY_METHOD.put("colname", col); + appList.add(CAUTION_MONEY_METHOD); + ProductBaseLoanTools.addAppList(appList, CAUTION_MONEY_METHOD.get("colname").toString(), "sortno", oder+sontno5); + } + } + +// String groupId = doTemp.getColumnAttribute(col, "groupid"); + if("0070".equals(groupId)) { + rule.put("financing", "true"); + } + + String ratioMin=StringUtil.nullToString(map.get(col).get("CostType09-MIN"));//比例最小值 + String ratioMax=StringUtil.nullToString(map.get(col).get("CostType09-MAX"));//比例最小值 + String ratioDefaultValue=StringUtil.nullToString(map.get(col).get("CostType09"));//比例限定值 + + rule.put("ratioFee", StringUtil.nullToString(map.get(col).get("CostType07")));//比例参考项 + rule.put("ratioType", inputModel);//比例计算方式 + + rule.put("min", min); + rule.put("max", max); + rule.put("defaultValue", defaultValue); + String para=""; + if(min.length()>0){ + rule.put("min", colName+"不能小于"+min+"@>="); + } + if(max.length()>0){ + rule.put("min", colName+"不能大于"+max+"@<="); + } + + //比例限定 + ratioRule.put("min", ratioMin); + ratioRule.put("max", ratioMax); + ratioRule.put("defaultValue", ratioDefaultValue); + para=""; + if(ratioMin.length()>0){ + ratioRule.put("min", colName+"比例不能小于"+ratioMin+"%@>="); + } + if(ratioMax.length()>0){ + ratioRule.put("min", colName+"比例不能大于"+ratioMax+"%@<="); + } + + if("InputMode03".equals(inputModel)){//互算 + rule.put("isShowRatio","true"); + if(defaultValue.length()>0){ + ProductBaseLoanTools.addAppList(appList, col, "defaultValue", defaultValue); + } + if(ratioDefaultValue.length()>0){ + ProductBaseLoanTools.addAppList(appList, col+"_RATIO", "defaultValue", ratioDefaultValue); + } + }else if("InputMode02".equals(inputModel)){//比例算金额 + rule.put("isShowRatio","true"); + ProductBaseLoanTools.addAppList(appList, col, "colreadonly", "1"); + if(ratioDefaultValue.length()>0){ + ProductBaseLoanTools.addAppList(appList, col+"_RATIO", "colreadonly", "1"); + ProductBaseLoanTools.addAppList(appList, col+"_RATIO", "defaultValue", ratioDefaultValue); + } + }else{ + rule.put("isShowRatio","true"); + ProductBaseLoanTools.addAppList(appList, col+"_RATIO", "colreadonly", "1"); + if(defaultValue.length()>0){ + ProductBaseLoanTools.addAppList(appList, col, "defaultValue", defaultValue); + ProductBaseLoanTools.addAppList(appList, col, "colreadonly", "1"); + ProductBaseLoanTools.addAppList(appList, col+"_FINA", "colreadonly", "1"); + } + if("N".equals(isShowRatio)){ + ProductBaseLoanTools.addAppList(appList, col, "colfilterrefid", ""); + rule.put("isShowRatio","false"); + } + } + for(Map.Entry entry:rule.entrySet()){ + sJson+="'"+entry.getKey()+"':'"+entry.getValue()+"',"; + } + sJson+="'ratioRule':"+FileOperatorUtil.getMapToJsonStr(ratioRule); + } + return "{"+sJson+"}"; + } + /** * 给模板加字段校验 * @param vali 检验规则集合 @@ -217,4 +376,74 @@ public class ProductConditionService { col.setAttribute("GROUPID", "fund_info");//分组 return col; } + + public void createFeeColApp(List> appList, String colname,Map column){ + colname = colname.toUpperCase(); + //使用名 + ProductBaseLoanTools.addAppList(appList, colname, "COLNAME".toLowerCase(), colname); + //显示序号 + ProductBaseLoanTools.addAppList(appList, colname, "COLINDEX".toLowerCase(), column.get("DISPLAY_ORDER")); + //排序号 + ProductBaseLoanTools.addAppList(appList, colname, "SORTNO".toLowerCase(), column.get("DISPLAY_ORDER")); + //是否有效 1 有效 0 无效 + ProductBaseLoanTools.addAppList(appList, colname, "ISINUSE".toLowerCase(), "1"); + // JBO属性名 + ProductBaseLoanTools.addAppList(appList, colname, "COLACTUALNAME".toLowerCase(), "''"); + //值类型 + ProductBaseLoanTools.addAppList(appList, colname, "COLTYPE".toLowerCase(), "Number"); + //默认值 + ProductBaseLoanTools.addAppList(appList, colname, "COLDEFAULTVALUE".toLowerCase(), "0"); + //显示名称 + ProductBaseLoanTools.addAppList(appList, colname, "COLHEADER".toLowerCase(), column.get("colheader")); + //编辑形式 + ProductBaseLoanTools.addAppList(appList, colname, "COLEDITSTYLE".toLowerCase(), column.get("Text")); + //格式检查 + ProductBaseLoanTools.addAppList(appList, colname, "COLCHECKFORMAT".toLowerCase(), "2"); + //对齐方式 + ProductBaseLoanTools.addAppList(appList, colname, "COLALIGN".toLowerCase(), "1"); + //可见 + ProductBaseLoanTools.addAppList(appList, colname, "COLVISIBLE".toLowerCase(), "1"); + //只读 + ProductBaseLoanTools.addAppList(appList, colname, "COLREADONLY".toLowerCase(), "0"); + //必填 + ProductBaseLoanTools.addAppList(appList, colname, "COLREQUIRED".toLowerCase(), "1"); + //分组 + ProductBaseLoanTools.addAppList(appList, colname, "GROUPID".toLowerCase(), "fund_info"); + //比例 + ProductBaseLoanTools.addAppList(appList, colname, "colfilterrefid".toLowerCase(), colname+"_RATIO"); + } + + public void createFeeColRatioApp(List> appList,String colname,Map column){ + colname = colname.toUpperCase(); + //使用名 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLNAME".toLowerCase(), colname+"_RATIO"); + //显示序号 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLINDEX".toLowerCase(), column.get("DISPLAY_ORDER")); + //排序号 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "SORTNO".toLowerCase(), column.get("DISPLAY_ORDER")); + //是否有效 1 有效 0 无效 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "ISINUSE".toLowerCase(), "1"); + // JBO属性名 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLACTUALNAME".toLowerCase(), "''"); + //值类型 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLTYPE".toLowerCase(), "Number"); + //默认值 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLDEFAULTVALUE".toLowerCase(), "0"); + //显示名称 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLHEADER".toLowerCase(), column.get("colheader")); + //编辑形式 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLEDITSTYLE".toLowerCase(), column.get("Text")); + //格式检查 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLCHECKFORMAT".toLowerCase(), "2"); + //对齐方式 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLALIGN".toLowerCase(), "1"); + //可见 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLVISIBLE".toLowerCase(), "0"); + //只读 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLREADONLY".toLowerCase(), "0"); + //必填 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "COLREQUIRED".toLowerCase(), "1"); + //分组 + ProductBaseLoanTools.addAppList(appList, colname+"_RATIO", "GROUPID".toLowerCase(), "fund_info"); + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java index 69bf52edf..e2cf315cb 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/doc/upload/service/impl/BusinessDocUploadServiceImpl.java @@ -31,14 +31,22 @@ public class BusinessDocUploadServiceImpl implements BusinessDocUploadService { private Map fieldMap; private List> fileList; + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + public void setFileList(List> fileList) { + this.fileList = fileList; + } + @SuppressWarnings({ "unchecked", "deprecation" }) public Map upload(HttpServletRequest request, HttpServletResponse response, JBOTransaction tx, Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception { Map testMap = (Map) MultipartDataUtil .readRequestParam(request, "UTF-8"); - fieldMap = (Map) testMap.get("fieldMap"); // 参数 - fileList = (List>) testMap.get("fileList"); // 资料列表 + fieldMap = fieldMap == null ? (Map) testMap.get("fieldMap") : fieldMap; // 参数 + fileList = fileList == null ? (List>) testMap.get("fileList") : fileList; // 资料列表 String applyType = "BusinessApplyApply"; String flowUnid = fieldMap.get("objectno") == null ? "" : fieldMap.get( "objectno").toString(); // 流程号 diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/controller/LoanSimulationBasicInfoController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/controller/LoanSimulationBasicInfoController.java index 93d109323..1bd1d5b23 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/controller/LoanSimulationBasicInfoController.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/controller/LoanSimulationBasicInfoController.java @@ -19,6 +19,23 @@ import com.base.util.ReturnMapUtil; @Path("/loan/simulation/basic") public class LoanSimulationBasicInfoController { + @Path("/product") + @POST + public Map product(@Context HttpServletRequest request, @Context HttpServletResponse response, + @Context JBOTransaction tx, @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog().info( + "[CONTROLLER] LoanSimulationBasicInfo run ................."); + ARE.getLog().info("[Path] /loan/simulation/basic/product" + " run ................."); + + LoanSimulationBasicService service = new LoanSimulationBasicServiceImpl(); + try { + return service.product(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + @Path("/query") @POST public Map queryInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/LoanSimulationBasicService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/LoanSimulationBasicService.java index c31632f44..35a647414 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/LoanSimulationBasicService.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/LoanSimulationBasicService.java @@ -11,6 +11,11 @@ import com.amarsoft.awe.util.Transaction; import com.base.util.ReturnMapUtil; public interface LoanSimulationBasicService { + Map product(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + Map queryInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @Context JBOTransaction tx, @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/impl/LoanSimulationBasicServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/impl/LoanSimulationBasicServiceImpl.java index a8287f996..f8ca86e36 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/impl/LoanSimulationBasicServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/loan/service/impl/LoanSimulationBasicServiceImpl.java @@ -1,5 +1,8 @@ package apx.com.amarsoft.als.apzl.apply.business.loan.service.impl; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -7,26 +10,67 @@ import javax.servlet.http.HttpServletResponse; import apx.com.amarsoft.als.apzl.apply.business.loan.manage.LoanSimulationBasicInfoAppInfoDoManage; import apx.com.amarsoft.als.apzl.apply.business.loan.manage.LoanSimulationBasicInfoAppInfoSaveDoManage; +import apx.com.amarsoft.als.apzl.apply.business.loan.product.ProductBaseLoanTools; import apx.com.amarsoft.als.apzl.apply.business.loan.service.LoanSimulationBasicService; import com.amarsoft.app.lc.workflow.action.GetFlowAction; import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.base.constant.RestfullConstant; +import com.base.util.JsonUtil; import com.base.util.MultipartDataUtil; import com.base.util.ReturnMapUtil; -import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.executor.CreateTransactionExecutor; -import com.tenwa.reckon.util.TbBeanTools; -import com.tenwa.util.SerialNumberUtil; public class LoanSimulationBasicServiceImpl implements LoanSimulationBasicService { private Map fieldMap; + @SuppressWarnings("unchecked") + public Map product(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); + + String flowunid = fieldMap.get("objectNo".toLowerCase()) == null ? "" + : fieldMap.get("objectNo".toLowerCase()).toString(); + + fieldMap.put("flowunid".toLowerCase(), flowunid); + fieldMap.put("flowunid".toUpperCase(), flowunid); + fieldMap.put("flow_unid".toLowerCase(), flowunid); + fieldMap.put("flow_unid".toUpperCase(), flowunid); + + // 获取 测算基础值及流水号 + Map baseMap = ProductBaseLoanTools.deadWork(null, null, + null, null, null, flowunid, tx); + // 费用规则 + List> appList = new ArrayList>(); + + String calcRules = ProductBaseLoanTools + .getProductFundRules(appList, baseMap.get("productId").toString()); + + Map calcRulesMap = JsonUtil.str2JSONObject(calcRules); + + Map body = new HashMap(); + body.put("planCName", baseMap.get("planCName")); + body.put("plannumber", baseMap.get("plannumber")); + body.put("tb", baseMap.get("tb")); + body.put("calType", baseMap.get("calType")); + + body.put("productId", baseMap.get("productId")); + body.put("productDatas", appList); + body.put("productFundRules", calcRulesMap); + + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + @SuppressWarnings("unchecked") public Map queryInfo(HttpServletRequest request, HttpServletResponse response, JBOTransaction tx, Transaction sqlca, @@ -37,65 +81,22 @@ public class LoanSimulationBasicServiceImpl implements String flowunid = fieldMap.get("objectNo".toLowerCase()) == null ? "" : fieldMap.get("objectNo".toLowerCase()).toString(); + String planCName = fieldMap.get("planCName".toLowerCase()) == null ? null + : fieldMap.get("planCName".toLowerCase()).toString(); // 方案编号 String plannumber = fieldMap.get("plannumber".toLowerCase()) == null ? null : fieldMap.get("plannumber".toLowerCase()).toString(); // 方案编号 - String productId = fieldMap.get("ProductId".toLowerCase()) == null ? null - : fieldMap.get("ProductId".toLowerCase()).toString(); - String calType = fieldMap.get("calType".toLowerCase()) == null ? null - : fieldMap.get("calType".toLowerCase()).toString(); + String conditionTB = fieldMap.get("tb".toLowerCase()) == null ? null + : fieldMap.get("tb".toLowerCase()).toString(); fieldMap.put("flowunid".toLowerCase(), flowunid); fieldMap.put("flowunid".toUpperCase(), flowunid); fieldMap.put("flow_unid".toLowerCase(), flowunid); fieldMap.put("flow_unid".toUpperCase(), flowunid); - /* 获取参数 */ - /* 根据参数判断 是否去数据库查询 */ - BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid); - if (productId == null) { - productId = flow.getAttribute("productId").getString(); - } - if (calType == null) { - calType = "proj_process"; - } - - TabCalBean tcb = TbBeanTools.getTabInfo(calType); - String planCName = tcb.getPlanCName(); - // 方案编号 - if (plannumber == null) { - if ("pay_process".equals(calType) - || "onHire_process".equals(calType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid and PAYMENT_NUMBER is not null and length(PAYMENT_NUMBER)>0 ") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName).getString(); - } - } else { -// String planType = ProductParamUtil.getProductParameterValue( -// productId, "PRD0314", "planinformation"); -// if ("SinglePlan".equals(planType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName) - .getString(); - } -// } - } - } - LoanSimulationBasicInfoAppInfoDoManage manage = new LoanSimulationBasicInfoAppInfoDoManage(); manage.setDono("LoanSimulationBasicInfoApp2"); manage.setsAddWhere(" and " + planCName + "='" + plannumber + "'"); - manage.setsJboClass(tcb.getCondition_tb()); + manage.setsJboClass(conditionTB); manage.setFieldMap(fieldMap); return manage.queryDefaultDo(request, sqlca, tx, ReturnMapUtil); } @@ -112,88 +113,20 @@ public class LoanSimulationBasicServiceImpl implements : fieldMap.get("objectNo".toLowerCase()).toString(); String plannumber = fieldMap.get("plannumber".toLowerCase()) == null ? null : fieldMap.get("plannumber".toLowerCase()).toString(); // 方案编号 - String productId = fieldMap.get("ProductId".toLowerCase()) == null ? null - : fieldMap.get("ProductId".toLowerCase()).toString(); - String calType = fieldMap.get("calType".toLowerCase()) == null ? null - : fieldMap.get("calType".toLowerCase()).toString(); + String planCName = fieldMap.get("planCName".toLowerCase()) == null ? null + : fieldMap.get("planCName".toLowerCase()).toString(); // 方案编号 + String conditionTB = fieldMap.get("tb".toLowerCase()) == null ? null + : fieldMap.get("tb".toLowerCase()).toString(); fieldMap.put("flowunid".toLowerCase(), flowunid); fieldMap.put("flowunid".toUpperCase(), flowunid); fieldMap.put("flow_unid".toLowerCase(), flowunid); fieldMap.put("flow_unid".toUpperCase(), flowunid); - /* 获取参数 */ - /* 根据参数判断 是否去数据库查询 */ - BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid); - if (productId == null) { - productId = flow.getAttribute("productId").getString(); - } - if (calType == null) { - calType = "proj_process"; - } - - TabCalBean tcb = TbBeanTools.getTabInfo(calType); - String planCName = tcb.getPlanCName(); - // 方案编号 - if (plannumber == null) { - if ("pay_process".equals(calType) - || "onHire_process".equals(calType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid and PAYMENT_NUMBER is not null and length(PAYMENT_NUMBER)>0 ") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName).getString(); - } - } else { -// String planType = ProductParamUtil.getProductParameterValue( -// productId, "PRD0314", "planinformation"); -// if ("SinglePlan".equals(planType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName) - .getString(); - } -// } - } - } - - // 新增数据 自动生成方案编号 - if (plannumber == null) { - String sSerialType = ""; - if ("proj_process".equals(calType)) { - BizObject proj = JBOFactory - .createBizObjectQuery( - "jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP", - "flowunid=:flowunid") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - sSerialType = proj.getAttribute("PROJECT_NO").getString(); - } else { - BizObject contract = JBOFactory - .createBizObjectQuery( - "jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP", - "flowunid=:flowunid") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - sSerialType = contract.getAttribute("CONTRACT_NO").getString(); - } - plannumber = SerialNumberUtil.getPlannumber(sSerialType, calType, - tx); - tx.commit(); - } - LoanSimulationBasicInfoAppInfoSaveDoManage manage = new LoanSimulationBasicInfoAppInfoSaveDoManage(); manage.setDono("LoanSimulationBasicInfoApp2"); manage.setAddWhere(" and " + planCName + "='" + plannumber + "'"); - manage.setsJboClass(tcb.getCondition_tb()); + manage.setsJboClass(conditionTB); manage.setFieldMap(fieldMap); String userId = request.getSession().getAttribute("userid").toString(); ASUser user = new ASUser(userId, sqlca); @@ -214,16 +147,14 @@ public class LoanSimulationBasicServiceImpl implements : fieldMap.get("objectNo".toLowerCase()).toString(); String plannumber = fieldMap.get("plannumber".toLowerCase()) == null ? null : fieldMap.get("plannumber".toLowerCase()).toString(); // 方案编号 - String productId = fieldMap.get("ProductId".toLowerCase()) == null ? null - : fieldMap.get("ProductId".toLowerCase()).toString(); - String calType = fieldMap.get("calType".toLowerCase()) == null ? null - : fieldMap.get("calType".toLowerCase()).toString(); fieldMap.put("flowunid".toLowerCase(), flowunid); fieldMap.put("flowunid".toUpperCase(), flowunid); fieldMap.put("flow_unid".toLowerCase(), flowunid); fieldMap.put("flow_unid".toUpperCase(), flowunid); + String productId = null; + String calType = null; /* 获取参数 */ /* 根据参数判断 是否去数据库查询 */ BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid); @@ -234,39 +165,6 @@ public class LoanSimulationBasicServiceImpl implements calType = "proj_process"; } - TabCalBean tcb = TbBeanTools.getTabInfo(calType); - String planCName = tcb.getPlanCName(); - // 方案编号 - if (plannumber == null) { - if ("pay_process".equals(calType) - || "onHire_process".equals(calType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid and PAYMENT_NUMBER is not null and length(PAYMENT_NUMBER)>0 ") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName).getString(); - } - } else { -// String planType = ProductParamUtil.getProductParameterValue( -// productId, "PRD0314", "planinformation"); -// if ("SinglePlan".equals(planType)) { - BizObject condtion = JBOFactory - .createBizObjectQuery( - "jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP", - "flowunid=:flowunid") - .setParameter("flowunid", flowunid) - .getSingleResult(false); - if (condtion != null) { - plannumber = condtion.getAttribute(planCName) - .getString(); - } -// } - } - } - CreateTransactionExecutor cte = new CreateTransactionExecutor(); cte.setCalType(calType); cte.setFlowunid(flowunid); diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java index 6074355d7..0b070f7dc 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/init/InitDocListTools.java @@ -20,79 +20,85 @@ import com.tenwa.doc.action.DocListInitAction; public class InitDocListTools { @SuppressWarnings({ "rawtypes", "unchecked" }) - public static void initDocList(String flowUnid, String userId, String carAttributes) throws Exception { - BizObjectManager objectManage = JBOFactory - .getBizObjectManager(FLOW_OBJECT.CLASS_NAME); - BizObject object = objectManage.createQuery("OBJECTNO=:OBJECTNO") - .setParameter("OBJECTNO", flowUnid).getSingleResult(false); - if (null == object) - return; - String flowNo = object.getAttribute("flowno") == null ? "" : object - .getAttribute("flowno").toString(); - String sObjectType = object.getAttribute("ObjectType") == null ? "" - : object.getAttribute("ObjectType").toString(); - String productId = ""; - BizObject flow = GetFlowAction.getFlowBussinessObject(flowUnid); - if (null == flow) - return; - productId = flow.getAttribute("productId").getString(); - - BizObjectManager businessManage = JBOFactory - .getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); - BizObject business = businessManage.createQuery("flow_unid=:flow_unid") - .setParameter("flow_unid", flowUnid).getSingleResult(false); - if (null == business) - return; - List list; + public static boolean initDocList(String flowUnid, String userId, String carAttributes) throws Exception { try { - list = ProductParamUtil.getProductDocInfo(productId, "PRD0412"); - } catch (Exception e) { - ARE.getLog().error(e); - return; - } - String type = ""; - String docList = ""; - for (int i = 0; i < list.size(); i++) { - Map map = (Map) list.get(i); - if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) { - type = map.get("TYPE").toString(); - if ("SingleRow".equals(type)) { - docList = map.get("DOCLIST").toString(); - } else { - List l = (List) map.get("DOCCONFIG"); - docList = l.toString(); + BizObjectManager objectManage = JBOFactory + .getBizObjectManager(FLOW_OBJECT.CLASS_NAME); + BizObject object = objectManage.createQuery("OBJECTNO=:OBJECTNO") + .setParameter("OBJECTNO", flowUnid).getSingleResult(false); + if (null == object) + return false; + String flowNo = object.getAttribute("flowno") == null ? "" : object + .getAttribute("flowno").toString(); + String sObjectType = object.getAttribute("ObjectType") == null ? "" + : object.getAttribute("ObjectType").toString(); + String productId = ""; + BizObject flow = GetFlowAction.getFlowBussinessObject(flowUnid); + if (null == flow) + return false; + productId = flow.getAttribute("productId").getString(); + + BizObjectManager businessManage = JBOFactory + .getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); + BizObject business = businessManage.createQuery("flow_unid=:flow_unid") + .setParameter("flow_unid", flowUnid).getSingleResult(false); + if (null == business) + return false; + List list; + try { + list = ProductParamUtil.getProductDocInfo(productId, "PRD0412"); + } catch (Exception e) { + ARE.getLog().error(e); + return false; + } + String type = ""; + String docList = ""; + for (int i = 0; i < list.size(); i++) { + Map map = (Map) list.get(i); + if ("BusinessApplyFlow".equals(map.get("FLOW_INFO").toString())) { + type = map.get("TYPE").toString(); + if ("SingleRow".equals(type)) { + docList = map.get("DOCLIST").toString(); + } else { + List l = (List) map.get("DOCCONFIG"); + docList = l.toString(); + } } } - } - String docClassItemno = docList;// CurPage.getParameter("docList"); - String[] itemnos=docClassItemno.split(","); - String s=""; - for(int i=0;i0){ - s=s.substring(0, s.length()-1); - } - - try { - ASUser CurUser = new ASUser(userId); - Map docParam=new HashMap(); - Map other=new HashMap(); - other.put("carAttributes", carAttributes); - docParam.put("ObjectType",sObjectType); - docParam.put("proj_id", flow.getAttribute("proj_id").getString()); - docParam.put("contract_id", flow.getAttribute("contract_id").getString()); - docParam.put("flow_unid", flowUnid); - docParam.put("inputtime", StringFunction.getTodayNow()); - docParam.put("inputuserid", CurUser.getUserID()); - docParam.put("inputorgid", CurUser.getOrgID()); - @SuppressWarnings("deprecation") - Configure CurConfig = Configure.getInstance(); - //判断是否存在,不存在就从配置表倒到临时表 - DocListInitAction.initDocList(docParam,other,docClassItemno,CurConfig); + String docClassItemno = docList;// CurPage.getParameter("docList"); + String[] itemnos=docClassItemno.split(","); + String s=""; + for(int i=0;i0){ + s=s.substring(0, s.length()-1); + } + + try { + ASUser CurUser = new ASUser(userId); + Map docParam=new HashMap(); + Map other=new HashMap(); + other.put("carAttributes", carAttributes); + docParam.put("ObjectType",sObjectType); + docParam.put("proj_id", flow.getAttribute("proj_id").getString()); + docParam.put("contract_id", flow.getAttribute("contract_id").getString()); + docParam.put("flow_unid", flowUnid); + docParam.put("inputtime", StringFunction.getTodayNow()); + docParam.put("inputuserid", CurUser.getUserID()); + docParam.put("inputorgid", CurUser.getOrgID()); + @SuppressWarnings("deprecation") + Configure CurConfig = Configure.getInstance(); + //判断是否存在,不存在就从配置表倒到临时表 + DocListInitAction.initDocList(docParam,other,docClassItemno,CurConfig); + } catch (Exception e) { + ARE.getLog().error(e); + return false; + } } catch (Exception e) { ARE.getLog().error(e); - return; + return false; } + return true; } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java index 79b35be73..f1e0dfdde 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java @@ -1,24 +1,29 @@ package apx.com.amarsoft.als.apzl.apply.business.start.service.impl; +import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import apx.com.amarsoft.als.apzl.apply.business.doc.upload.service.BusinessDocUploadService; +import apx.com.amarsoft.als.apzl.apply.business.doc.upload.service.impl.BusinessDocUploadServiceImpl; import apx.com.amarsoft.als.apzl.apply.business.start.bo.BusinessBO; -import apx.com.amarsoft.als.apzl.apply.business.start.service.BusinessApplyStartService; import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools; +import apx.com.amarsoft.als.apzl.apply.business.start.service.BusinessApplyStartService; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.util.Transaction; import com.base.constant.RestfullConstant; +import com.base.util.DateUtil; import com.base.util.MultipartDataUtil; import com.base.util.ReturnMapUtil; public class BusinessApplyStartServiceImpl implements BusinessApplyStartService { private Map fieldMap; - + private List> fileList; @SuppressWarnings("unchecked") public Map applyStart(HttpServletRequest request, HttpServletResponse response, JBOTransaction tx, Transaction sqlca, @@ -27,6 +32,7 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService Map testMap = (Map) MultipartDataUtil .readRequestParam(request, "UTF-8"); fieldMap = (Map) testMap.get("fieldMap"); + fileList = (List>) testMap.get("fileList"); BusinessBO bo = new BusinessBO(fieldMap, tx); tx.commit(); String sReturnInfo = bo.getMsg(); @@ -44,7 +50,26 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService ReturnMapUtil.setReturnMap(body, RestfullConstant.baseProperty.get("success").toString(), "发起成功"); - InitDocListTools.initDocList(params.get("FlowUnid"), fieldMap.get("userid").toString(), bo.getCarAttributes()); + // 加载附件 + boolean flag = InitDocListTools.initDocList(params.get("FlowUnid"), + fieldMap.get("userid").toString(), bo.getCarAttributes()); + + String certType = bo.getCerttype(); + String date = DateUtil.getDateTime(new Date()); + if (flag && "ind01".equals(certType.toLowerCase()) + && (fileList != null && fileList.size() > 0)) { // 承租人身份证(正反面)照片 + fieldMap.put("objectNo".toUpperCase(), params.get("FlowUnid")); + fieldMap.put("objectNo".toLowerCase(), params.get("FlowUnid")); + + fieldMap.put("docname".toUpperCase(), "承租人身份证(正反面)"); + fieldMap.put("docname".toLowerCase(), "承租人身份证(正反面)"); + + fieldMap.put("remark".toUpperCase(), "业务申请流程手机APP发起 - 上传资料照片 - " + date); + fieldMap.put("remark".toLowerCase(), "业务申请流程手机APP发起 - 上传资料照片 - " + date); + BusinessDocUploadServiceImpl service = new BusinessDocUploadServiceImpl(); + service.setFieldMap(fieldMap); + service.setFileList(fileList); + } } else if (sReturnInfo.startsWith("failed")) { ReturnMapUtil.setReturnMap(null, RestfullConstant.baseProperty.get("FAIL").toString(),