From 813a1279981fb5d4d6fa60ac42ccb0a3b8e47b8d Mon Sep 17 00:00:00 2001 From: gityjf <2211675158@qq.com> Date: Thu, 28 Jan 2021 13:56:54 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=96=E5=80=BC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tenwa/lease/app/allinpay/servlet/AllinpayServlet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/tenwa/lease/app/allinpay/servlet/AllinpayServlet.java b/src/com/tenwa/lease/app/allinpay/servlet/AllinpayServlet.java index ba30bfcb3..c82c3ab3a 100644 --- a/src/com/tenwa/lease/app/allinpay/servlet/AllinpayServlet.java +++ b/src/com/tenwa/lease/app/allinpay/servlet/AllinpayServlet.java @@ -204,10 +204,10 @@ public class AllinpayServlet extends BaseServlet { certId = signObj.getCertId(); collectType = signObj.getCollectType(); } - if(StringUtils.isEmpty(collectType) || "YLcollect".equals(collectType)){ + if (StringUtils.isEmpty(collectType) || "YLcollect".equals(collectType)) { request.setAttribute("state", "500"); request.setAttribute("title", "服务器内部异常"); - request.setAttribute("message", "签约渠道与签约类型【"+collectType+"】不一致,请联系业务人员"); + request.setAttribute("message", "签约渠道与签约类型【" + collectType + "】不一致,请联系业务人员"); return errorPage; } if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(accNumber) || StringUtils.isEmpty(certId) || StringUtils.isEmpty(collectType)) { @@ -279,7 +279,7 @@ public class AllinpayServlet extends BaseServlet { String accNumber = res.getString("accNumber"); String certId = res.getString("certId"); String collectType = res.getString("collectType"); - signDto = new SignDto(userName, phoneNumber, accNumber, certId, collectType); + signDto = new SignDto(userName, phoneNumber, certId, accNumber, collectType); } Sqlca.commit(); } catch (Exception e) { From 99323a4f2c00d5ab2235de86a098dd001225aee2 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Thu, 28 Jan 2021 22:27:39 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=9A=84IRR=E5=92=8CROA=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/component-parameter-config.xml | 2 +- .../reckon/executor/CashFlowExecutor.java | 44 +++++++++++++++++-- .../tenwa/reckon/help/ConditionHelper.java | 41 ++++++++++++----- 3 files changed, 73 insertions(+), 14 deletions(-) diff --git a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml index 74b15c2b0..2c9e1fa9f 100644 --- a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml +++ b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml @@ -196,4 +196,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/calc/com/tenwa/reckon/executor/CashFlowExecutor.java b/calc/com/tenwa/reckon/executor/CashFlowExecutor.java index e8f9d7053..bef110f0c 100644 --- a/calc/com/tenwa/reckon/executor/CashFlowExecutor.java +++ b/calc/com/tenwa/reckon/executor/CashFlowExecutor.java @@ -95,6 +95,8 @@ public class CashFlowExecutor { } private void add(ConditionBean cb,TabCalBean tcb) throws Exception{ + + Map> productRevenues = tcb.getProductRevenues(); String sql = ""; if("MYSQL".equals(InitDBType.DBTYPE)){ sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; @@ -124,8 +126,14 @@ public class CashFlowExecutor { } sql +=" if(fundplan.pay_type='pay_type_in',fundplan.plan_money,-fundplan.plan_money) cleanfow " ; sql +=" from "+Tools.getTable(tcb.getFundFundPlan_tb())+" fundplan " ; - sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno " ; - sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"'"; + sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno and tdd.codeno='FeeType' " ; + sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and fundplan.fee_type in ('feetype2','feetype1','feetype10','feetype16','feetype17') "; + //如果是灵活产品减去产品中配置的GPS差额 + if("Y".equals( cb.getFlexible() ) ){ + Map> productRevenue = tcb.getProductRevenues(); + String GPSDifference = productRevenues.get( "GPSDifference" ).get( "GPSDifference" ); + sql += "union all select DATE_FORMAT(CURDATE(),'%Y/%m/%d') plan_date,'"+GPSDifference+"' flowin,'GPS差额:"+GPSDifference+"' flowindetail,'' flowout,'' flowoutdetil,'"+GPSDifference+"' cleanfow from dual "; + } }else if("ORACLE".equals(InitDBType.DBTYPE)){ sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; sql += ",plan_date"; @@ -176,8 +184,38 @@ public class CashFlowExecutor { sql +=" )t group by t.plan_date "; Transaction Sqlca =null; Sqlca = Transaction.createTransaction(tx); - SqlObject asql = new SqlObject(sql); + SqlObject asql = new SqlObject(""); + asql.setOriginalSql(sql); Sqlca.executeSQL(asql); + //由于安鹏目前没有从最后一期一直往前抵扣,这里临时处理下灵活产品的 + if( "Y".equals( cb.getFlexible() ) ){ + String lcftSql = "select ID,PLAN_DATE,FUND_IN,FUND_OUT from lc_cash_flow_temp where flowunid ='"+tcb.getDocId()+"' and "+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' order by plan_date desc"; + List> lcftDate =DataOperatorUtil.getDataBySql(tx, lcftSql, null); + BigDecimal outMoney = null ; + BigDecimal inMoney = null ; + String updateSql = "" ; + for (int i=0 ; i < lcftDate.size() ; i++ ) { + if(i==0){ + outMoney = new BigDecimal(lcftDate.get(i).get("FUND_OUT") ); + inMoney = new BigDecimal(lcftDate.get(i).get("FUND_IN") ); + }else{ + inMoney = new BigDecimal(lcftDate.get(i).get("FUND_IN") ); + } + if(outMoney.compareTo(inMoney)>=0){ + updateSql = " update lc_cash_flow_temp set FUND_OUT='"+inMoney+"',FUND_OUT_DETAILS='抵扣保证金:"+inMoney+"',NET_FLOW='0.00' where id='"+lcftDate.get(i).get("ID")+"' "; + asql.setOriginalSql(updateSql); + Sqlca.executeSQL(asql); + outMoney = outMoney.subtract(inMoney); + }else{ + updateSql = " update lc_cash_flow_temp set FUND_OUT='"+inMoney.subtract(outMoney)+"',FUND_OUT_DETAILS='抵扣保证金:"+inMoney.subtract(outMoney)+"',NET_FLOW='"+inMoney.subtract(outMoney)+"' where id='"+lcftDate.get(i).get("ID")+"' "; + asql.setOriginalSql(updateSql); + Sqlca.executeSQL(asql); + break; + } + } + + } + } diff --git a/calc/com/tenwa/reckon/help/ConditionHelper.java b/calc/com/tenwa/reckon/help/ConditionHelper.java index b00be94e4..9f6746e00 100644 --- a/calc/com/tenwa/reckon/help/ConditionHelper.java +++ b/calc/com/tenwa/reckon/help/ConditionHelper.java @@ -66,7 +66,6 @@ public class ConditionHelper { if(cb.getSettleMethod().equals("irregular_rent")){ params.put("INCOME_NUMBER",cb.getIncomeNumber()+""); } - if((cb.getSettleMethod().equals("even_corpus")&&cb.getRentOrRate().equals("corpus_period"))||cb.getSettleMethod().equals("irregular_rent")||cb.getSettleMethod().equals("even_subsection")||(cb.getSettleMethod().equals("even_rent_day")&&(cb.getRentOrRate().equals("rent_period")||cb.getRentOrRate().equals("rent_period_360")))){ params.put("FIRST_PLAN_DATE", cb.getFirstPlanDate()); params.put("SECOND_PLAN_DATE", cb.getSecondPlanDate()); @@ -108,14 +107,15 @@ public class ConditionHelper { BigDecimal handRate =null; //手续费税率 BigDecimal gpsInstallFee =null;//GPS税率 BigDecimal rentRate =null;// 租金税率 + BigDecimal percentage = new BigDecimal("100"); if( pslData!=null && pslData.size()>0){ String leasform = pslData.get(0).get("leasform"); List> rateData = DataOperatorUtil.getDataBySql("select t.INTEREST_RATE,t.HAND_RATE,t.gps_install_fee,t.rent from (select INTEREST_RATE,HAND_RATE,gps_install_fee,rent,CONTRACT_DATE from TAX_INFO where CONTRACT_DATE<= DATE_FORMAT(NOW(),'%Y/%m/%d') and BEFORE_AFTER='after' and lease_form='"+leasform+"' union all select INTEREST_RATE,HAND_RATE,gps_install_fee,rent,CONTRACT_DATE from TAX_INFO where CONTRACT_DATE>=DATE_FORMAT(NOW(),'%Y/%m/%d') and BEFORE_AFTER='before' and lease_form='"+leasform+"' ) t order by t.CONTRACT_DATE desc limit 1"); if( rateData!=null && rateData.size()>0 ){ - interestRate =new BigDecimal ( rateData.get(0).get("INTEREST_RATE") ).divide(new BigDecimal("100")) ; - handRate =new BigDecimal (rateData.get(0).get("HAND_RATE") ).divide(new BigDecimal("100")) ;; - gpsInstallFee =new BigDecimal (rateData.get(0).get("gps_install_fee") ).divide(new BigDecimal("100")) ; - rentRate =new BigDecimal ( rateData.get(0).get("rent") ).divide(new BigDecimal("100")) ; + interestRate = BigDecimal.ONE.add( new BigDecimal ( rateData.get(0).get("INTEREST_RATE") ).divide(percentage) ); + handRate = BigDecimal.ONE.add( new BigDecimal (rateData.get(0).get("HAND_RATE") ).divide(percentage) ); + gpsInstallFee = BigDecimal.ONE.add( new BigDecimal (rateData.get(0).get("gps_install_fee") ).divide( percentage ) ); + rentRate = BigDecimal.ONE.add( new BigDecimal ( rateData.get(0).get("rent") ).divide( percentage ) ); }else{ throw new BusinessException( "未配置对应税率!" ); } @@ -131,25 +131,46 @@ public class ConditionHelper { // 手续费 BigDecimal handlingChargeMoney = new BigDecimal( cb.getHandlingChargeMoney() ); // GPS差额 - BigDecimal gpsDifference = new BigDecimal( cb.getGPSDifference() ); +// BigDecimal gpsDifference = new BigDecimal( cb.getGPSDifference() ); + BigDecimal gpsDifference = new BigDecimal( productRevenues.get( "GPSDifference" ).get( "GPSDifference" ) );//取产品收益中的GPS差额配置 // 收入 BigDecimal in = allInterest.divide( interestRate , 2, 4 ).add( handlingChargeMoney.divide( handRate, 2, 4 ) ).add( gpsDifference.divide( gpsInstallFee, 2, 4 ) ); // 租赁年限 - int leaseTerm = cb.getLeaseTerm(); + int leaseTerm = cb.getLeaseTerm()/12; // 融资额 BigDecimal cleanLeaseMoney = new BigDecimal( cb.getCleanLeaseMoney() ); + + String rentSql = "select corpus,ALL_REMAIN_CORPUS from LC_RENT_PLAN_TEMP where flowunid ='"+cb.getDocId()+"' order by plan_date"; + List> rentPlanData =DataOperatorUtil.getDataBySql(tx, rentSql, null); + BigDecimal cautionMoney = new BigDecimal( cb.getCautionMoney() ); + BigDecimal costMoney = BigDecimal.ZERO; + BigDecimal CostInterestRate = new BigDecimal (productRevenues.get( "CostInterestRate" ).get( "CostInterestRate" ) ).divide( percentage ) ;//产品中的成本利率 + for (Map map : rentPlanData) { + BigDecimal surplus = new BigDecimal(map.get("corpus") ).add(new BigDecimal(map.get("ALL_REMAIN_CORPUS"))); + if(surplus.compareTo(cautionMoney)>0){ + costMoney = costMoney.add( surplus.subtract(cautionMoney).multiply( CostInterestRate).divide( new BigDecimal("12"), 2 , 4 ) ); + } + } + System.out.println(costMoney); // 成本 - BigDecimal cost = cleanLeaseMoney.add( new BigDecimal( cb.getCautionMoney() ).multiply( new BigDecimal( leaseTerm ) ) ).divide( rentRate, 2, 4 ); + BigDecimal cost = costMoney.add( new BigDecimal( cb.getCautionMoney() ).multiply( new BigDecimal( leaseTerm ) ).multiply(CostInterestRate) ).divide( rentRate, 2, 4 ); // 运营费率 String operatingRate = productRevenues.get( "OperatingRate" ).get( "OperatingRate" ); // 运营费用 - BigDecimal operatingExpenses = cleanLeaseMoney.multiply( new BigDecimal( operatingRate ) ); + BigDecimal operatingExpenses = cleanLeaseMoney.multiply( new BigDecimal( operatingRate ).divide( percentage ) ); // 风险计提比率 String riskAccrualRatio = productRevenues.get( "RiskAccrualRatio" ).get( "RiskAccrualRatio" ); // 风险计提 - BigDecimal withdrawalRisk = cleanLeaseMoney.multiply( new BigDecimal( riskAccrualRatio ) ); + BigDecimal withdrawalRisk = cleanLeaseMoney.multiply( new BigDecimal( riskAccrualRatio ).divide( percentage ) ); // ROA BigDecimal roa = in.subtract( cost ).subtract( operatingExpenses ).subtract( withdrawalRisk ).multiply( new BigDecimal( 0.75 ) ).divide( cleanLeaseMoney, 2, 4 ).multiply( new BigDecimal( 2 ) ); + StringBuilder sb = new StringBuilder(); + sb.append(cb.getDocId()).append("的ROA计算参数=利息和:").append(allInterest).append(",利息税率:").append(interestRate).append(",手续费:").append(handlingChargeMoney) + .append(",手续费税率:").append(handRate).append(",GPS差额:").append(gpsDifference).append(",GPS差额税率:").append(gpsInstallFee) + .append(",租金表里成本和:").append(costMoney).append(",保证金金额:").append(cb.getCautionMoney()).append(",租赁年限:").append(leaseTerm) + .append(",成本利率:").append(CostInterestRate).append(",租金税率:").append(rentRate).append(",融资金额:").append(cleanLeaseMoney) + .append(",运营费率:").append(new BigDecimal( operatingRate ).divide( percentage ) ).append(",风险计提比率:").append( new BigDecimal( riskAccrualRatio ).divide( percentage ) ); + System.out.println(sb.toString()); if ( roa.compareTo( new BigDecimal( roaValue ).divide( new BigDecimal("100") ) ) < 0 ) { throw new BusinessException( "ROA小于产品配置!" ); } From 93e4ce2f23126d3366f2d47e44a47ed4d60bd94f Mon Sep 17 00:00:00 2001 From: gityjf <2211675158@qq.com> Date: Fri, 29 Jan 2021 09:16:31 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E9=80=9A=E8=81=94=E7=AD=BE=E7=BA=A6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/Sign_index.jsp | 14 +++++++++---- WebContent/js/jquery/register.js | 34 ++++++++------------------------ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/WebContent/Sign_index.jsp b/WebContent/Sign_index.jsp index 5f33c77a7..a66b6d47f 100644 --- a/WebContent/Sign_index.jsp +++ b/WebContent/Sign_index.jsp @@ -90,8 +90,8 @@ --%> - - + +
 
@@ -110,7 +110,7 @@ 发送验证码 - +
@@ -147,6 +147,11 @@ --%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/BusinessChangeApplyReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/BusinessChangeApplyReport.jsp new file mode 100644 index 000000000..e20f58213 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/BusinessChangeApplyReport.jsp @@ -0,0 +1,139 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: 付款申请 + History Log: + */ + String userid=CurUser.getUserID(); + + BizObjectManager b=JBOFactory.getBizObjectManager("jbo.awe.USER_INFO"); + BizObject boo = b.createQuery("userid=:userid").setParameter("userid", userid).getSingleResult(false); + + + String BELONGORG = boo.getAttribute("BELONGORG").toString(); + System.out.println(BELONGORG); + ASObjectModel doTemp = new ASObjectModel("BusinessChangeApplyReport"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + + //导出模板编号 + String template = ""; + doTemp.appendJboWhere(" and ui.BELONGORG='"+BELONGORG+"'"); + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + //导出有权限 + template = "20cd01d204b84726962cbdeba698f5d1"; + }else{ + //导出无权限 + template = "06d4e377ce88426f832490898ce390ff"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="0"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","申请详情","申请详情","viewHisTabRead()","","","","btn_icon_detail",""}, + //{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundPaymentCarApplyReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundPaymentCarApplyReport.jsp new file mode 100644 index 000000000..a753f6698 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundPaymentCarApplyReport.jsp @@ -0,0 +1,139 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: 付款申请 + History Log: + */ + String userid=CurUser.getUserID(); + + BizObjectManager b=JBOFactory.getBizObjectManager("jbo.awe.USER_INFO"); + BizObject boo = b.createQuery("userid=:userid").setParameter("userid", userid).getSingleResult(false); + + + String BELONGORG = boo.getAttribute("BELONGORG").toString(); + System.out.println(BELONGORG); + ASObjectModel doTemp = new ASObjectModel("FundPaymentCarApplyReport"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + + //导出模板编号 + String template = ""; + doTemp.appendJboWhere(" and ui.BELONGORG='"+BELONGORG+"'"); + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + //导出有权限 + template = "20cd01d204b84726962cbdeba698f5d1"; + }else{ + //导出无权限 + template = "06d4e377ce88426f832490898ce390ff"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="0"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","申请详情","申请详情","viewHisTabRead()","","","","btn_icon_detail",""}, + //{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java b/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java index 9ada189ce..724861896 100644 --- a/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java +++ b/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java @@ -614,7 +614,7 @@ public class GetFlowAction { param.put("Assignfinish", bo.getAttribute("Assignfinish").getString()); param.put("AssignSubmittype", bo.getAttribute("Assignsubmittype").getString()); param.put("EndTime", bo.getAttribute("endtime").getString()); - String roleId = curPage.getUser().hasRole("401")?"401":"";//汽车业务申请 + String roleId = (curPage.getUser().hasRole("401")||curPage.getUser().hasRole("800R00000051"))?"401":"";//汽车业务申请 if("".equals(roleId)){//传统项目信审 roleId = curPage.getUser().hasRole("800R00000027")?"800R00000027":curPage.getUser().hasRole("800R00000035")?"800R00000035":""; } From afa6003d6c9ca3afb87a50b5106f6c7e66c61d6f Mon Sep 17 00:00:00 2001 From: maliang Date: Fri, 29 Jan 2021 14:25:08 +0800 Subject: [PATCH 05/10] =?UTF-8?q?fix:=E5=88=86=E6=94=AF=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B0=86=E9=9C=80=E8=A6=81=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java b/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java index 724861896..02d9d8844 100644 --- a/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java +++ b/src/com/amarsoft/app/lc/workflow/action/GetFlowAction.java @@ -615,6 +615,7 @@ public class GetFlowAction { param.put("AssignSubmittype", bo.getAttribute("Assignsubmittype").getString()); param.put("EndTime", bo.getAttribute("endtime").getString()); String roleId = (curPage.getUser().hasRole("401")||curPage.getUser().hasRole("800R00000051"))?"401":"";//汽车业务申请 + if("".equals(roleId)){//传统项目信审 roleId = curPage.getUser().hasRole("800R00000027")?"800R00000027":curPage.getUser().hasRole("800R00000035")?"800R00000035":""; } From 7379f6f4049e0925bb541751055d8d4b5254d2aa Mon Sep 17 00:00:00 2001 From: gityjf <2211675158@qq.com> Date: Fri, 29 Jan 2021 15:31:37 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ajax=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/js/jquery/register.js | 1 + 1 file changed, 1 insertion(+) diff --git a/WebContent/js/jquery/register.js b/WebContent/js/jquery/register.js index a061540bf..a5246f9ae 100644 --- a/WebContent/js/jquery/register.js +++ b/WebContent/js/jquery/register.js @@ -124,6 +124,7 @@ async : true, dataType: "json", data : { + "method":"allinPaySendMessages", "projectId":projectId, "signType":signType }, From a2be8ebd25251c9e781a353a382ee9928d8ac8d6 Mon Sep 17 00:00:00 2001 From: gityjf <2211675158@qq.com> Date: Fri, 29 Jan 2021 15:33:45 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tenwa/message/JobSendMessage.java | 106 ++-- src_tenwa/com/tenwa/message/QuartzJobMsg.java | 550 +++++++++--------- 2 files changed, 318 insertions(+), 338 deletions(-) diff --git a/src_tenwa/com/tenwa/message/JobSendMessage.java b/src_tenwa/com/tenwa/message/JobSendMessage.java index ab8455580..051dd9670 100644 --- a/src_tenwa/com/tenwa/message/JobSendMessage.java +++ b/src_tenwa/com/tenwa/message/JobSendMessage.java @@ -1,81 +1,62 @@ package com.tenwa.message; +import com.alibaba.fastjson.JSONObject; +import com.amarsoft.are.jbo.*; +import com.tenwa.lease.util.SendMessageUtil; +import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + import java.text.SimpleDateFormat; import java.util.Date; -import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.Job; -import org.quartz.JobDetail; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.Scheduler; -import org.quartz.Trigger; -import org.quartz.impl.StdSchedulerFactory; - -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.tenwa.lease.util.SendMessageUtil; - public class JobSendMessage implements Job{ - + private Log logger = LogFactory.getLog(this.getClass()); - private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + @Override public void execute(JobExecutionContext context) throws JobExecutionException { JBOTransaction tx = null; + String smsnoticeid = null; try { tx= JBOFactory.createJBOTransaction(); - Scheduler sch = StdSchedulerFactory.getDefaultScheduler(); - Trigger tri = context.getTrigger(); - JobDetail jobDetail = sch.getJobDetail(tri.getJobKey()); + smsnoticeid = context.getJobDetail().getJobDataMap().getString("smsnoticeid"); + logger.info("short message running..... LB_SMS_NOTICE_TASKS[ID]: "+smsnoticeid); BizObjectManager bomNotice = JBOFactory.getBizObjectManager(LB_SMS_NOTICE_TASKS.CLASS_NAME,tx); - BizObject notice = bomNotice.createQuery("id=:id").setParameter("id", jobDetail.getJobDataMap().getString("smsnoticeid")).getSingleResult(true); - int max = 1;//短信发送失败重新发送次数 + BizObject notice = bomNotice.createQuery("id=:id").setParameter("id", smsnoticeid).getSingleResult(true); if(notice != null){ if(notice.getAttribute("send_flag").getInt() == 0){ String result = null; - long pauseTime = 0; + boolean flagErrStatus = true; try { - for(int i=0;i0){ - break; - } - if("0".equals(result.substring(0,1))){ - break; - }else{ - logger.error("短信发送失败,5秒后重新发送..."); - sch.pauseTrigger(tri.getKey()); - pauseTime = new Date().getTime(); - } - while(true){ - if(new Date().getTime()-pauseTime >=5000){ - sch.resumeTrigger(tri.getKey()); - break; - } - } - } + result = SendMessageUtil.sendMessageByHttpClient(notice.getAttribute("phone_number").getString(), notice.getAttribute("sms_content").getString()); + if(!result.matches("^[0-9].*")){ + JSONObject jsonObject = JSONObject.parseObject(result); + if(jsonObject.getIntValue("status")==100){ + flagErrStatus = false; + result = "全部成功"; + }else{ + result = getResultCodeInfoNew(jsonObject.getString("status")); + } + } } catch (Exception e) { - logger.error("短信发送任务执行失败。", e); + logger.error("短信发送任务执行失败,LB_SMS_NOTICE_TASKS[ID] : "+smsnoticeid, e); result = "发送失败,发送遇到异常:" + e.getMessage(); } notice.setAttributeValue("sms_type", "IMMEDIATELY"); - notice.setAttributeValue("send_result", getResultCodeInfo(result)); + notice.setAttributeValue("send_result", result); notice.setAttributeValue("send_time", sdf.format(new Date())); - notice.setAttributeValue("send_flag", 1); + notice.setAttributeValue("send_flag", flagErrStatus ? 0 : 1); + bomNotice.saveObject(notice); } - bomNotice.saveObject(notice); } tx.commit(); } catch (Exception e) { - e.printStackTrace(); + logger.error("short message error LB_SMS_NOTICE_TASKS[ID] : "+smsnoticeid ,e); try { tx.rollback(); } catch (JBOException e1) { @@ -83,7 +64,26 @@ public class JobSendMessage implements Job{ } } } - + + public static String getResultCodeInfoNew(String code){ + String codeMessage = ""; + switch(code){ + case "101": codeMessage = "参数错误"; break; + case "102": codeMessage = "号码错误"; break; + case "103": codeMessage = "当日余量不足"; break; + case "104": codeMessage = "请求超时"; break; + case "105": codeMessage = "用户余量不足"; break; + case "106": codeMessage = "非法用户"; break; + case "107": codeMessage = "提交号码超限"; break; + case "111": codeMessage = "签名不合法"; break; + case "120": codeMessage = "内容长度超长,请不要超过500个字"; break; + case "121": codeMessage = "内容中有屏蔽词"; break; + case "131": codeMessage = "IP非法"; break; + default : codeMessage = code ; break; + } + return codeMessage; + } + public static String getResultCodeInfo(String code){ String codeMessage = ""; switch(code){ diff --git a/src_tenwa/com/tenwa/message/QuartzJobMsg.java b/src_tenwa/com/tenwa/message/QuartzJobMsg.java index 841df4dea..16a72dc89 100644 --- a/src_tenwa/com/tenwa/message/QuartzJobMsg.java +++ b/src_tenwa/com/tenwa/message/QuartzJobMsg.java @@ -1,297 +1,277 @@ package com.tenwa.message; +import com.amarsoft.are.ARE; +import com.amarsoft.are.jbo.*; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import com.tenwa.quartz.DateUtil; +import com.tenwa.reckon.util.UUIDUtil; +import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS; +import jbo.sys.MSG_CONFIG; +import org.quartz.*; +import org.quartz.impl.StdSchedulerFactory; + import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; -import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS; -import jbo.sys.MSG_CONFIG; +public class QuartzJobMsg implements Job { -import org.quartz.CronExpression; -import org.quartz.CronScheduleBuilder; -import org.quartz.Job; -import org.quartz.JobBuilder; -import org.quartz.JobDataMap; -import org.quartz.JobDetail; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.JobKey; -import org.quartz.ListenerManager; -import org.quartz.Scheduler; -import org.quartz.Trigger; -import org.quartz.TriggerBuilder; -import org.quartz.TriggerKey; -import org.quartz.impl.StdSchedulerFactory; -import org.quartz.impl.matchers.KeyMatcher; + public static final String MSG_GROUP_NAME = "MSG_DEFAULT_GROUP"; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; -import com.tenwa.quartz.DateUtil; -import com.tenwa.quartz.JobListenerImpl; -import com.tenwa.quartz.TriggerListenerImpl; -import com.tenwa.reckon.util.UUIDUtil; + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + JBOTransaction tx = null; + JBOTransaction inner_tx = null; + try { + tx = JBOFactory.createJBOTransaction(); + Transaction tran = Transaction.createTransaction(tx); + Trigger trigger = context.getTrigger(); + JobDataMap data = context.getJobDetail().getJobDataMap(); + //获取主键 + String id = data.getString("id"); + //获取sql语句 + String msgsql = data.getString("msgSql"); + //获取关键字 + String msgsqlparam = data.getString("msgsqlparam"); + //获取短信内容 + String msgcontent = data.getString("msgcontent"); + //获取触发方式 + String triggermode = data.getString("triggermode"); + //获取短信发送时间类型、短信延迟发送天数、短信发送时间点 + String msgsendtype = data.getString("msgsendtype");//短信发送类型 + String msgsendtime = "";//短信发送时间点 + Date timeSet = null; + boolean checkTime = false; + Date timeNow = new Date(); + if (data.getString("msgsendtime") != null) { + msgsendtime = data.getString("msgsendtime"); + timeSet = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(new SimpleDateFormat("yyyy-MM-dd").format(timeNow) + " " + msgsendtime); + } + String delayday = "";//延迟发送天数 + if (data.getString("delayday") != null) { + delayday = data.getString("delayday"); + } + //获得过期是否执行 + String isoverdateexecute = data.getString("isoverdateexecute"); + //获取短信类型 + String msgtype = data.getString("msgType"); + if ("Tl_Business".equals(msgtype) || "Tl_ChangeBusiness".equals(msgtype) || "Tl_MakeContract".equals(msgtype) || "Tl_ChangeContract".equals(msgtype) || "Tl_AfterRenting".equals(msgtype)) { + msgcontent = msgcontent.replace("@", "="); + } + //获取是否按日期去重 + String isrepatebydate = data.getString("isrepeatbydate"); + //获取短信替换参数 + int oldlength = msgcontent.length(); + int newlength = msgcontent.replace("}", "").length(); + String[] params = new String[oldlength - newlength]; + if (params.length > 0) { + int index = 0; + for (int i = 0; i < params.length; i++) { + int start = msgcontent.indexOf("{", index); + int end = msgcontent.indexOf("}", index); + params[i] = msgcontent.substring(start + 1, end); + index = end + 1; + } + } + JBOFactory.getBizObjectManager(MSG_CONFIG.CLASS_NAME, tx).createQuery("update O set previous_fire_time=:previousFireTime , next_fire_time=:nextFireTime where id='" + id + "'") + .setParameter("previousFireTime", trigger.getPreviousFireTime().getTime()) + .setParameter("nextFireTime", trigger.getNextFireTime() == null ? "" : String.valueOf(trigger.getNextFireTime().getTime())).executeUpdate(); + ASResultSet rs = tran.getASResultSet(new SqlObject(msgsql)); + Scheduler scheduler = getScheduler(); + Transaction inner_tran = null; + while (rs.next()) { + boolean flag = false; + for (int p = 0; p < params.length; p++) { + if (rs.getString(params[p]) == null) { + flag = true; + } + } + if (flag) { + continue; + } + String rsMsgContent = msgcontent; + Object phonenumber = rs.getString("phonenumber"); + if (phonenumber == null || phonenumber.toString().length() != 11) { + continue; + } + //新起数据库连接 + inner_tx = JBOFactory.createJBOTransaction(); + inner_tran = Transaction.createTransaction(inner_tx); + //查询关联记录 + String sql = "select * from msg_send_relative where 1=1 "; + String[] sqlparams = msgsqlparam.split("&"); + if (sqlparams.length > 0) { + for (int i = 0; i < sqlparams.length; i++) { + sql += "and " + sqlparams[i] + "='" + rs.getString(sqlparams[i]).toString() + "' "; + } + } + if (isrepatebydate.equals("yes")) {//根据日期去重 + sql += "and inputtime='" + rs.getString("checkdate") + "'"; + } + if (msgtype.startsWith("holiday") || msgtype.startsWith("birthday")) {//如果是生日祝福和节假日祝福必须添加短信类型和日期条件筛选 + sql += "and msg_type='" + msgtype + "' and inputtime='" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "'"; + } else { + sql += "and msg_type='" + msgtype + "'"; + } + sql = sql.replaceAll(":", "△"); + SqlObject so = new SqlObject(sql); + so.setRunSql(so.getRunSql().replaceAll("△", ":")); + ASResultSet msgSend = inner_tran.getASResultSet(so); -public class QuartzJobMsg implements Job{ - - public static final String MSG_GROUP_NAME = "MSG_DEFAULT_GROUP"; - - @Override - public void execute(JobExecutionContext context) throws JobExecutionException { - JBOTransaction tx = null; - try{ - tx= JBOFactory.createJBOTransaction(); - Transaction tran = Transaction.createTransaction(tx); - Scheduler sch = StdSchedulerFactory.getDefaultScheduler(); - Trigger trigger = context.getTrigger(); - JobDetail detail = sch.getJobDetail(trigger.getJobKey()); - JobDataMap data = detail.getJobDataMap(); - //获取主键 - String id = data.getString("id"); - //获取sql语句 - String msgsql = data.getString("msgSql"); - //获取关键字 - String msgsqlparam = data.getString("msgsqlparam"); - //获取短信内容 - String msgcontent = data.getString("msgcontent"); - //获取触发方式 - String triggermode = data.getString("triggermode"); - //获取短信发送时间类型、短信延迟发送天数、短信发送时间点 - String msgsendtype = data.getString("msgsendtype");//短信发送类型 - String msgsendtime = "";//短信发送时间点 - Date timeSet = null; - boolean checkTime = false; - Date timeNow = new Date(); - if(data.getString("msgsendtime") != null){ - msgsendtime = data.getString("msgsendtime"); - timeSet = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(new SimpleDateFormat("yyyy-MM-dd").format(timeNow)+" "+msgsendtime); - } - String delayday = "";//延迟发送天数 - if(data.getString("delayday") != null){ - delayday = data.getString("delayday"); - } - //获得过期是否执行 - String isoverdateexecute = data.getString("isoverdateexecute"); - //获取短信类型 - String msgtype = data.getString("msgType"); - if("Tl_Business".equals(msgtype) || "Tl_ChangeBusiness".equals(msgtype)|| "Tl_MakeContract".equals(msgtype)|| "Tl_ChangeContract".equals(msgtype)|| "Tl_AfterRenting".equals(msgtype)){ - msgcontent = msgcontent.replace("@", "="); - } - //获取是否按日期去重 - String isrepatebydate = data.getString("isrepeatbydate"); - //获取短信替换参数 - int oldlength = msgcontent.length(); - int newlength = msgcontent.replace("}", "").length(); - String[] params = new String[oldlength-newlength]; - if(params.length>0){ - int index = 0; - for(int i=0;i0){ - for(int i=0;i dataMap = new HashMap(); - dataMap.put("smsnoticeid", sn.getAttribute("ID").getString()); - - Class jobClass = Class.forName("com.tenwa.message.JobSendMessage"); - JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(jobName, MSG_GROUP_NAME) - .usingJobData(new JobDataMap(dataMap)).requestRecovery("1".equals(isoverdateexecute)?true:false).storeDurably(false).build(); - - Date startTime = DateUtil.getTimeByFormat(DateUtil.getDateTime(new Date()), "yyyy-MM-dd HH:mm:ss"); - //动态创建时间表达式 - String cron = ""; - Calendar ca = Calendar.getInstance(); - ca.setTime(new Date()); - if(timeSet != null){ - if(timeSet.compareTo(timeNow) <= 0){ - checkTime = true; - } - cron += msgsendtime.split(":")[2]+" "; - cron += msgsendtime.split(":")[1]+" "; - cron += msgsendtime.split(":")[0]+" "; - if(checkTime){ - cron = ""; - String tNow = new SimpleDateFormat("HH:mm:ss").format(new Date(new Date().getTime()+2000)); - cron += tNow.split(":")[2]+" "; - cron += tNow.split(":")[1]+" "; - cron += tNow.split(":")[0]+" "; - } - } - CronExpression ce = null; - column += ",msg_send_jobname,msg_send_triggername"; - value += ",'"+jobName+"','"+triggerName+"'"; - insertSql = insertSql.replace("column", column); - insertSql = insertSql.replace("data", value); - insertSql = insertSql.replaceAll(":", "△"); - SqlObject soInsert = new SqlObject(insertSql); - soInsert.setRunSql(soInsert.getRunSql().replaceAll("△", ":")); - tran.executeSQL(new SqlObject(insertSql)); - - switch(msgsendtype){ - case "msg_time_type01"://当天立即 - cron = ""; - String tNow = new SimpleDateFormat("HH:mm:ss").format(new Date(new Date().getTime()+2000)); - cron += tNow.split(":")[2]+" "; - cron += tNow.split(":")[1]+" "; - cron += tNow.split(":")[0]+" "; - cron += ca.get(Calendar.DAY_OF_MONTH)+" "; - cron += (ca.get(Calendar.MONTH)+1)+" ? *"; - ce = new CronExpression(cron); - trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime()+(24*60*60*1000))) - .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) - .build(); - getScheduler().scheduleJob(jobDetail,trigger); - sn.setAttributeValue("sms_type", "IMMEDIATELY"); - break; - case "msg_time_type02"://当天指定时间 - cron += ca.get(Calendar.DAY_OF_MONTH)+" "; - cron += (ca.get(Calendar.MONTH)+1)+" ? *"; - ce = new CronExpression(cron); - trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime()+(24*60*60*1000))) - .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) - .build(); - getScheduler().scheduleJob(jobDetail,trigger); - break; - case "msg_time_type03"://本周最后一天 - cron += ca.getActualMaximum(Calendar.DAY_OF_WEEK_IN_MONTH)+" "; - cron += (ca.get(Calendar.MONTH)+1)+" ? *"; - ce = new CronExpression(cron); - trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime()+(8*24*60*60*1000))) - .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) - .build(); - getScheduler().scheduleJob(jobDetail,trigger); - break; - case "msg_time_type04"://本月最后一天 - cron += ca.getActualMaximum(Calendar.DAY_OF_MONTH)+" "; - cron += (ca.get(Calendar.MONTH)+1)+" ? *"; - ce = new CronExpression(cron); - trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime()+(31*24*60*60*1000))) - .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) - .build(); - getScheduler().scheduleJob(jobDetail,trigger); - break; - case "msg_time_type05"://延迟天 - cron += (ca.get(Calendar.DAY_OF_MONTH)+Integer.parseInt(delayday))+" "; - cron += (ca.get(Calendar.MONTH)+1)+" ? *"; - ce = new CronExpression(cron); - trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime()+(Integer.parseInt(delayday)*24*60*60*1000))) - .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) - .build(); - getScheduler().scheduleJob(jobDetail,trigger); - break; - } - sn.setAttributeValue("notice_time", DateUtil.getDateTime(ce.getNextValidTimeAfter(startTime))); - ListenerManager lm = sch.getListenerManager(); - KeyMatcher keyMetcher = KeyMatcher.keyEquals(JobKey.jobKey(jobName, MSG_GROUP_NAME)); - lm.addJobListener(new JobListenerImpl(), keyMetcher); - bomLSNT.saveObject(sn); - } - } - tx.commit(); - } catch (Exception e) { - e.printStackTrace(); - try { - tx.rollback(); - } catch (JBOException e1) { - e1.printStackTrace(); - } - } - } - - public Scheduler getScheduler() throws Exception - { - return StdSchedulerFactory.getDefaultScheduler(); - } + //关联记录不存在,新建短信任务,发送短信通知 + if (!msgSend.next()) { + for (int i = 0; i < params.length; i++) { + rsMsgContent = rsMsgContent.replace(params[i], rs.getString(params[i])); + } + rsMsgContent = rsMsgContent.replace("{", ""); + rsMsgContent = rsMsgContent.replace("}", ""); + //创建短信发送记录 + BizObjectManager bomLSNT = JBOFactory.getBizObjectManager(LB_SMS_NOTICE_TASKS.CLASS_NAME, inner_tx); + BizObject sn = bomLSNT.newObject(); + sn.setAttributeValue("inputuserid", rs.getString("proj_manage") != null ? rs.getString("proj_manage") : data.getString("userID")); + sn.setAttributeValue("customer_id", rs.getString("customer_id")); + sn.setAttributeValue("phone_number", phonenumber.toString()); + sn.setAttributeValue("send_flag", 0); + sn.setAttributeValue("sms_content", rsMsgContent); + sn.setAttributeValue("sms_type", "DELAYED"); + sn.setAttributeValue("inputtime", DateUtil.getDateTime(new Date())); + bomLSNT.saveObject(sn); + + if ("trigger_mode02".equals(triggermode)) {//手动触发,不需要定时代理 + continue; + } + + //关联表生成记录 + String insertSql = "insert into msg_send_relative (id,sms_id,msg_type,column) values('" + UUIDUtil.getUUID() + "','" + sn.getAttribute("ID").getString() + "','" + msgtype + "',data)"; + String column = ""; + String value = ""; + for (int m = 0; m < sqlparams.length; m++) { + column += "," + sqlparams[m]; + value += ",'" + rs.getString(sqlparams[m]).toString() + "'"; + } + column = column.substring(1, column.length()); + value = value.substring(1, value.length()); + if (msgtype.startsWith("holiday") || msgtype.startsWith("birthday")) { + column += ",inputtime"; + value += ",'" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "'"; + } + if (isrepatebydate.equals("yes")) {//根据日期去重 + column += ",inputtime"; + value += ",'" + rs.getString("checkdate") + "'"; + } + + String jobName = UUIDUtil.getUUID(); + String triggerName = UUIDUtil.getUUID(); + //记录短信发送定时代理 + column += ",msg_send_jobname,msg_send_triggername"; + value += ",'" + jobName + "','" + triggerName + "'"; + insertSql = insertSql.replace("column", column); + insertSql = insertSql.replace("data", value); + + insertSql = insertSql.replaceAll(":", "△"); + SqlObject soInsert = new SqlObject(insertSql); + soInsert.setRunSql(soInsert.getRunSql().replaceAll("△", ":")); + inner_tran.executeSQL(new SqlObject(insertSql)); + + Date startTime = DateUtil.getTimeByFormat(DateUtil.getDateTime(new Date()), "yyyy-MM-dd HH:mm:ss"); + //动态创建时间表达式 + String cron = ""; + Calendar ca = Calendar.getInstance(); + ca.setTime(new Date()); + if (timeSet != null) { + if (timeSet.compareTo(timeNow) <= 0) { + checkTime = true; + } + cron += msgsendtime.split(":")[2] + " "; + cron += msgsendtime.split(":")[1] + " "; + cron += msgsendtime.split(":")[0] + " "; + if (checkTime) { + cron = ""; + String tNow = new SimpleDateFormat("HH:mm:ss").format(new Date(new Date().getTime() + 2000)); + cron += tNow.split(":")[2] + " "; + cron += tNow.split(":")[1] + " "; + cron += tNow.split(":")[0] + " "; + } + } + + //定时任务处理 + Map dataMap = new HashMap(); + dataMap.put("smsnoticeid", sn.getAttribute("ID").getString()); + JobDetail jobDetail = JobBuilder.newJob(JobSendMessage.class).withIdentity(jobName, MSG_GROUP_NAME) + .usingJobData(new JobDataMap(dataMap)).requestRecovery("1".equals(isoverdateexecute) ? true : false).storeDurably(false).build(); + CronExpression ce = null; + switch (msgsendtype) { + case "msg_time_type01"://当天立即 + cron = ""; + String tNow = new SimpleDateFormat("HH:mm:ss").format(new Date(new Date().getTime() + 2000)); + cron += tNow.split(":")[2] + " "; + cron += tNow.split(":")[1] + " "; + cron += tNow.split(":")[0] + " "; + cron += ca.get(Calendar.DAY_OF_MONTH) + " "; + cron += (ca.get(Calendar.MONTH) + 1) + " ? *"; + ce = new CronExpression(cron); + trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime() + (24 * 60 * 60 * 1000))) + .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) + .build(); + sn.setAttributeValue("sms_type", "IMMEDIATELY"); + ARE.getLog().warn(triggerName + " cron : " + cron); + break; + case "msg_time_type02"://当天指定时间 + cron += ca.get(Calendar.DAY_OF_MONTH) + " "; + cron += (ca.get(Calendar.MONTH) + 1) + " ? *"; + ce = new CronExpression(cron); + trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime() + (24 * 60 * 60 * 1000))) + .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) + .build(); + break; + case "msg_time_type03"://本周最后一天 + cron += ca.getActualMaximum(Calendar.DAY_OF_WEEK_IN_MONTH) + " "; + cron += (ca.get(Calendar.MONTH) + 1) + " ? *"; + ce = new CronExpression(cron); + trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime() + (8 * 24 * 60 * 60 * 1000))) + .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) + .build(); + break; + case "msg_time_type04"://本月最后一天 + cron += ca.getActualMaximum(Calendar.DAY_OF_MONTH) + " "; + cron += (ca.get(Calendar.MONTH) + 1) + " ? *"; + ce = new CronExpression(cron); + trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime() + (31 * 24 * 60 * 60 * 1000))) + .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) + .build(); + break; + case "msg_time_type05"://延迟天 + cron += (ca.get(Calendar.DAY_OF_MONTH) + Integer.parseInt(delayday)) + " "; + cron += (ca.get(Calendar.MONTH) + 1) + " ? *"; + ce = new CronExpression(cron); + trigger = TriggerBuilder.newTrigger().forJob(jobName, MSG_GROUP_NAME).withIdentity(triggerName, MSG_GROUP_NAME).startAt(startTime).endAt(new Date(new Date().getTime() + (Integer.parseInt(delayday) * 24 * 60 * 60 * 1000))) + .withSchedule(CronScheduleBuilder.cronSchedule(ce).withMisfireHandlingInstructionDoNothing()) + .build(); + break; + } + sn.setAttributeValue("notice_time", DateUtil.getDateTime(ce.getNextValidTimeAfter(startTime))); + bomLSNT.saveObject(sn); + scheduler.scheduleJob(jobDetail, trigger); + } + inner_tran.commit(); + } + tran.commit(); + } catch (Exception e) { + e.printStackTrace(); + try { + if (tx != null) tx.rollback(); + if (inner_tx != null) inner_tx.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + } + } + + public Scheduler getScheduler() throws Exception { + return StdSchedulerFactory.getDefaultScheduler(); + } } \ No newline at end of file From 170daa93e17d877c1fcec1b0cc947c03f0066023 Mon Sep 17 00:00:00 2001 From: gityjf <2211675158@qq.com> Date: Fri, 29 Jan 2021 15:34:19 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseFunction/BaseFlowFunction.jspf | 2 +- src/com/amarsoft/app/flow/FlowAction.java | 296 +++++++++--------- 2 files changed, 152 insertions(+), 146 deletions(-) diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf index 2b997e5bf..92dcb115c 100644 --- a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf +++ b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf @@ -115,7 +115,7 @@ FlowFunction.doSubmit=function(sObjectType,sObjectNo,sTaskNo,sFlowName,sFlowNo,s alert("提交成功!"); FlowFunction.successCallBackReload(); }else{ - alert("提交失败!"); + alert(sPhaseInfo); } },"提交下一步");} },sFlowName+":预警检查"); diff --git a/src/com/amarsoft/app/flow/FlowAction.java b/src/com/amarsoft/app/flow/FlowAction.java index bf85fd3d6..494cbb258 100644 --- a/src/com/amarsoft/app/flow/FlowAction.java +++ b/src/com/amarsoft/app/flow/FlowAction.java @@ -2,13 +2,7 @@ package com.amarsoft.app.flow; import java.sql.SQLException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.TreeMap; +import java.util.*; import jbo.app.APP_BUSINESS_TEMPLATE; import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; @@ -248,6 +242,9 @@ public class FlowAction { this.flowService = flowService; } + //处理重复提交数据重复,只适用单体服务 + private static Set taskSet = new HashSet<>(); + /** * 初始化流程 * @@ -1027,70 +1024,76 @@ public class FlowAction { */ public String submit(JBOTransaction tx) throws Exception { String str = "success", attribute7, endTime = StringFunction.getTodayNow(); - int attribute8; - BizObjectManager ftManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK", tx); - - BizObject ft = ftManager.createQuery( - "select O.relativeSerialNo,O.endTime,FM.attribute7,FM.attribute8 from O,jbo.sys.FLOW_MODEL FM where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and serialNo=:serialNo ") - .setParameter("serialNo", taskNo).getSingleResult(false); - if (ft == null) {return "此流程任务已经不存在,请刷新列表!"; - } else if (!StringX.isEmpty(ft.getAttribute("endTime"))) { - return "此流程任务已自动提交!"; + if(taskSet.contains(taskNo)){ + return "此流程任务已发起提交,勿重复发起!"; } + try { + ARE.getLog().warn("duplicate data validate use flow_task : "+taskNo); + taskSet.add(taskNo); + int attribute8; + BizObjectManager ftManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK", tx); - //处理任务池 - BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx); - BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx); - BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + userID + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true); - if(utdbo != null) { - int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid") - + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt(); - ARE.getLog().info("***********任务池日志***:为"+ taskNo + "的" + utdbo.getAttribute("userid") + "用户关闭一个任务,当前未处理待办数为" + taskNumber); - String status = utdbo.getAttribute("status").toString(); - if("approve_status01".equals(status)) { - utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid") - + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate(); + BizObject ft = ftManager.createQuery( + "select O.relativeSerialNo,O.endTime,FM.attribute7,FM.attribute8 from O,jbo.sys.FLOW_MODEL FM where O.flowNo=FM.flowNo and O.phaseNo=FM.phaseNo and serialNo=:serialNo ") + .setParameter("serialNo", taskNo).getSingleResult(false); + if (ft == null) {return "此流程任务已经不存在,请刷新列表!"; + } else if (!StringX.isEmpty(ft.getAttribute("endTime"))) { + return "此流程任务已自动提交!"; } - utdbo.setAttributeValue("status", "approve_status02"); - utdbo.setAttributeValue("endtime", StringFunction.getTodayNow()); - utdbom.saveObject(utdbo); - } - // 更新beginTime锁这些记录 - ftManager - .createQuery( - "update O set beginTime=beginTime where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") - .setParameter("relativeSerialNo", - ft.getAttribute("relativeSerialNo").getString()) - .executeUpdate(); - // 查相同relativeserialno且不是5000传阅阶段的记录 - BizObject allTaskNumBo = ftManager - .createQuery(" select count(1) as v.allTaskNum from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") - .setParameter("relativeSerialNo",ft.getAttribute("relativeSerialNo").getString()).getSingleResult(false); - int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt(); - //多人处理 - if (allTaskNum > 1) { - attribute7 = ft.getAttribute("attribute7").getString();// 01,单人处理,02,多人全部,03,多人任一,04,N人处理 - attribute8 = ft.getAttribute("attribute8").getInt();// N人处理时设置的人数 - if ("04".equals(attribute7)&& (ft.getAttribute("attribute8").isNull()|| attribute8 >= allTaskNum || attribute8 < 1)) { - // 如果N人处理时没设置人数,则当做 - // 02,多人全部 - attribute7 = "02"; + //处理任务池 + BizObjectManager utdbom = JBOFactory.getBizObjectManager(USER_TASK_DATA.CLASS_NAME, tx); + BizObjectManager utibom = JBOFactory.getBizObjectManager(USER_TASK_INFO.CLASS_NAME, tx); + BizObject utdbo = utdbom.createQuery("taskno = '" + taskNo + "' and userid = '" + userID + "' and (status = 'approve_status01' or status = 'approve_status03')").getSingleResult(true); + if(utdbo != null) { + int taskNumber = utibom.createQuery("userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").getSingleResult(false).getAttribute("task_number").getInt(); + ARE.getLog().info("***********任务池日志***:为"+ taskNo + "的" + utdbo.getAttribute("userid") + "用户关闭一个任务,当前未处理待办数为" + taskNumber); + String status = utdbo.getAttribute("status").toString(); + if("approve_status01".equals(status)) { + utibom.createQuery("update O set task_number = task_number - 1 where userid = '" + utdbo.getAttribute("userid") + + "' and roleid = '" + utdbo.getAttribute("roleid") + "'").executeUpdate(); + } + utdbo.setAttributeValue("status", "approve_status02"); + utdbo.setAttributeValue("endtime", StringFunction.getTodayNow()); + utdbom.saveObject(utdbo); } - // 已提交的任务数 - BizObject commitedTaskNumBo = ftManager + + // 更新beginTime锁这些记录 + ftManager .createQuery( - " select count(1) as v.commited from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' and endTime is not null and length(endTime)>0 ") + "update O set beginTime=beginTime where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") .setParameter("relativeSerialNo", ft.getAttribute("relativeSerialNo").getString()) - .getSingleResult(false); - int commited = commitedTaskNumBo.getAttribute("commited").getInt(); + .executeUpdate(); + // 查相同relativeserialno且不是5000传阅阶段的记录 + BizObject allTaskNumBo = ftManager + .createQuery(" select count(1) as v.allTaskNum from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") + .setParameter("relativeSerialNo",ft.getAttribute("relativeSerialNo").getString()).getSingleResult(false); + int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt(); + //多人处理 + if (allTaskNum > 1) { + attribute7 = ft.getAttribute("attribute7").getString();// 01,单人处理,02,多人全部,03,多人任一,04,N人处理 + attribute8 = ft.getAttribute("attribute8").getInt();// N人处理时设置的人数 + if ("04".equals(attribute7)&& (ft.getAttribute("attribute8").isNull()|| attribute8 >= allTaskNum || attribute8 < 1)) { + // 如果N人处理时没设置人数,则当做 + // 02,多人全部 + attribute7 = "02"; + } + // 已提交的任务数 + BizObject commitedTaskNumBo = ftManager + .createQuery( + " select count(1) as v.commited from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' and endTime is not null and length(endTime)>0 ") + .setParameter("relativeSerialNo", + ft.getAttribute("relativeSerialNo").getString()) + .getSingleResult(false); + int commited = commitedTaskNumBo.getAttribute("commited").getInt(); - if ("02".equals(attribute7) && commited + 1 < allTaskNum /* + if ("02".equals(attribute7) && commited + 1 < allTaskNum /* * 多人全部,已提交人数 * +1<总人数 */ - || "04".equals(attribute7) && commited + 1 < attribute8 /* + || "04".equals(attribute7) && commited + 1 < attribute8 /* * N人处理, * 已提交人数 * + @@ -1098,95 +1101,98 @@ public class FlowAction { * < * N */) { - // 仅结束当前任务 - ftManager - .createQuery( - "update O set endTime=:endTime,phaseAction=:phaseAction where serialNo=:serialNo") - .setParameter("serialNo", taskNo) - .setParameter("phaseAction", "未达到人数") - .setParameter("endTime", endTime).executeUpdate(); - return str; + // 仅结束当前任务 + ftManager + .createQuery( + "update O set endTime=:endTime,phaseAction=:phaseAction where serialNo=:serialNo") + .setParameter("serialNo", taskNo) + .setParameter("phaseAction", "未达到人数") + .setParameter("endTime", endTime).executeUpdate(); + return str; + } } + + if (!StringX.isSpace(phaseAction)) + phaseAction = phaseAction.replace("@", ","); + + // 根据任务编号,查出流程的编号,阶段编号,对象类型,对象编号:新增加xuyunlong 归档每一步归档 + ft = ftManager + .createQuery( + "select O.flowno,O.phaseno,O.FLOWSTATE,O.ASSIGNEDTASKNO,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ") + .setParameter("serialNo", taskNo).getSingleResult(false); + // 将数据保存到历史记录里 + PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft + .getAttribute("phaseno").getString(), + ft.getAttribute("objecttype").getString(), + ft.getAttribute("objectno").getString(), taskNo, ft + .getAttribute("userid").getString(), + ft.getAttribute("orgid").getString(), tx); + + if (this.phaseOpinion.equals("1000") + || this.phaseOpinion.equals("8000")) { + // 删除流程互斥 + FlowUtil.deleteWorkFlowConflict(ft.getAttribute("objectno") + .getString(), tx); + Map condtion = new HashMap(); + condtion.put("FlowUnid", ft.getAttribute("objectno").getString()); + DataOperatorUtil.deleteJBOByCondtion(FLOW_STEP_NODE.CLASS_NAME, + condtion, tx); + } + if(this.nextNodeType.indexOf("JOIN")>=0){ + if(this.getIsStepLastUser(tx).equals("No")){ + ftManager + .createQuery( + "update O set endTime=:endTime,phaseAction=:phaseAction,taskstate=1 where serialNo=:serialNo") + .setParameter("serialNo", taskNo) + .setParameter("phaseAction", "另外一个分支没有结束") + .setParameter("endTime", endTime).executeUpdate(); + + }else{ + flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx); + Transaction Sqlca =null; + Sqlca = Transaction.createTransaction(tx); + ASResultSet rs = null; + String sql="update flow_task set userid=replace(userid,'*','') where objectno=:objectno and userid like '*%' "; + SqlObject asql = new SqlObject(sql); + asql.setParameter("objectno",ft.getAttribute("objectno").getString()); + Sqlca.executeSQL(asql); + } + }else{ + flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx); + + if(ft.getAttribute("FLOWSTATE").getString().equals("ANYBACK")){ //退回之后再提交 + + if(ft.getAttribute("ASSIGNEDTASKNO")!=null){ + if(ft.getAttribute("ASSIGNEDTASKNO").getString().length()>0){//如果退回再提交给原处理人要更新状态 + ftManager.createQuery("update o set FLOWSTATE='NORMAL' WHERE objectno=:objectno and endtime is null") + .setParameter("objectno", ft.getAttribute("objectno").getString()).executeUpdate(); + } + } + } + } + // 更新代理人 + BizObject taskUser = ftManager.createQuery("select O.userId from O where O.SERIALNO=:taskNo").setParameter("taskNo", this.taskNo).getSingleResult(false); + if (!taskUser.getAttribute("userId").getString().equals(this.userID)) { + this.doFinishAssignTask(tx); + } + // 更新其他任务的endTime + ftManager + .createQuery( + "update O set endTime=:endTime, phaseAction=:phaseAction where ( endTime is null or endTime='' ) and relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") + .setParameter("relativeSerialNo", + ft.getAttribute("relativeSerialNo").getString()) + .setParameter("endTime", endTime) + .setParameter("phaseAction", "AutoFinish").executeUpdate(); + // 生成传阅的代办 + this.startPassedByUser(tx); + savePushMsg(tx); + //流程或步骤结束之后的通知 + new FLowStepEndNotice().StepEndNotice(tx, ft.getAttribute("objectno").getString(),this.taskNo,"next"); + }finally { + taskSet.remove(taskNo); + ARE.getLog().warn("current keep duplicate validate : "+taskSet.toString()); } - - if (!StringX.isSpace(phaseAction)) - phaseAction = phaseAction.replace("@", ","); - - // 根据任务编号,查出流程的编号,阶段编号,对象类型,对象编号:新增加xuyunlong 归档每一步归档 - ft = ftManager - .createQuery( - "select O.flowno,O.phaseno,O.FLOWSTATE,O.ASSIGNEDTASKNO,O.objecttype,O.objectno,O.userid,O.orgid from O where serialNo=:serialNo ") - .setParameter("serialNo", taskNo).getSingleResult(false); - // 将数据保存到历史记录里 - PhaseInfoArchive(ft.getAttribute("flowno").getString(), ft - .getAttribute("phaseno").getString(), - ft.getAttribute("objecttype").getString(), - ft.getAttribute("objectno").getString(), taskNo, ft - .getAttribute("userid").getString(), - ft.getAttribute("orgid").getString(), tx); - - if (this.phaseOpinion.equals("1000") - || this.phaseOpinion.equals("8000")) { - // 删除流程互斥 - FlowUtil.deleteWorkFlowConflict(ft.getAttribute("objectno") - .getString(), tx); - Map condtion = new HashMap(); - condtion.put("FlowUnid", ft.getAttribute("objectno").getString()); - DataOperatorUtil.deleteJBOByCondtion(FLOW_STEP_NODE.CLASS_NAME, - condtion, tx); - } - if(this.nextNodeType.indexOf("JOIN")>=0){ - if(this.getIsStepLastUser(tx).equals("No")){ - ftManager - .createQuery( - "update O set endTime=:endTime,phaseAction=:phaseAction,taskstate=1 where serialNo=:serialNo") - .setParameter("serialNo", taskNo) - .setParameter("phaseAction", "另外一个分支没有结束") - .setParameter("endTime", endTime).executeUpdate(); - - }else{ - flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx); - Transaction Sqlca =null; - Sqlca = Transaction.createTransaction(tx); - ASResultSet rs = null; - String sql="update flow_task set userid=replace(userid,'*','') where objectno=:objectno and userid like '*%' "; - SqlObject asql = new SqlObject(sql); - asql.setParameter("objectno",ft.getAttribute("objectno").getString()); - Sqlca.executeSQL(asql); - } - }else{ - flowService.commitAction(taskNo, phaseAction, phaseOpinion, "", tx); - - if(ft.getAttribute("FLOWSTATE").getString().equals("ANYBACK")){ //退回之后再提交 - - if(ft.getAttribute("ASSIGNEDTASKNO")!=null){ - if(ft.getAttribute("ASSIGNEDTASKNO").getString().length()>0){//如果退回再提交给原处理人要更新状态 - ftManager.createQuery("update o set FLOWSTATE='NORMAL' WHERE objectno=:objectno and endtime is null") - .setParameter("objectno", ft.getAttribute("objectno").getString()).executeUpdate(); - } - } - } - } - // 更新代理人 - BizObject taskUser = ftManager.createQuery("select O.userId from O where O.SERIALNO=:taskNo").setParameter("taskNo", this.taskNo).getSingleResult(false); - if (!taskUser.getAttribute("userId").getString().equals(this.userID)) { - this.doFinishAssignTask(tx); - } - // 更新其他任务的endTime - ftManager - .createQuery( - "update O set endTime=:endTime, phaseAction=:phaseAction where ( endTime is null or endTime='' ) and relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' ") - .setParameter("relativeSerialNo", - ft.getAttribute("relativeSerialNo").getString()) - .setParameter("endTime", endTime) - .setParameter("phaseAction", "AutoFinish").executeUpdate(); - // 生成传阅的代办 - this.startPassedByUser(tx); - savePushMsg(tx); - //流程或步骤结束之后的通知 - new FLowStepEndNotice().StepEndNotice(tx, ft.getAttribute("objectno").getString(),this.taskNo,"next"); return str; - } /** From 9fb0b03342bbb35e024d561e1966ceb46b4a4bf6 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Fri, 29 Jan 2021 15:49:51 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=BF=9D=E8=AF=81=E9=87=91=E5=92=8C=E9=A6=96?= =?UTF-8?q?=E4=BB=98=E6=AC=BE=E6=AF=94=E4=BE=8B=E5=92=8C=E7=9A=84=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoanSimulation/LoanBasicInfo.jsp | 19 +- .../etc/app/component/component-config.xml | 2118 ++++++++--------- .../component/component-parameter-config.xml | 2 +- 3 files changed, 1078 insertions(+), 1061 deletions(-) diff --git a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp index 39612b1b5..7e981f817 100644 --- a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp @@ -107,12 +107,18 @@ }else{ doTemp.setReadOnly("YEAR_RATE", true); } - + String bondAndPaymentsMin = ""; + String bondAndPaymentsMan = ""; if ( "Y".equals( flexible ) ) { doTemp.setReadOnly( "YEAR_RATE", false ); doTemp.setHtmlEvent( "YEAR_RATE", "onchange", "changeYearRate" ); // 年利率事件 doTemp.setHtmlEvent( "RENT_VALUE", "onchange", "changeRentValue" ); // 预计租金事件 doTemp.setDefaultValue( "GPS_DIFFERENCE", ProductParamUtil.getProductParameterValue( productId, "PRD0390", "GPSDifference", "GPSDifference" ) ); + + Map> ProductRevenue = ProductParamUtil.getProductComponentType(productId, "PRD0390"); + Map bondAndPayments = ProductRevenue.get("bondAndPayments"); + bondAndPaymentsMin = bondAndPayments.get("bondAndPayments-MIN"); + bondAndPaymentsMan = bondAndPayments.get("bondAndPayments-MAX"); } /*设置字段事件*/ @@ -1159,6 +1165,17 @@ function saveRecord(sPostEvents){ } else { setItemValue( 0, 0, 'RENT_OR_RATE', 'rate' ); } + var cautionMoneyRatio = getItemValue( 0, 0, 'CAUTION_MONEY_RATIO' ); + var firstPaymentRatio = getItemValue( 0, 0, 'FIRST_PAYMENT_RATIO' ); + var sumcf = parseFloat(cautionMoneyRatio) + parseFloat(firstPaymentRatio) ; + //var firstPaymentRatio = getItemValue( 0, 0, 'FIRST_PAYMENT_RATIO' ); + var bondAndPaymentsMin= '<%=bondAndPaymentsMin%>'; + var bondAndPaymentsMan= '<%=bondAndPaymentsMan%>'; + if(sumcf < bondAndPaymentsMin || sumcf > bondAndPaymentsMan ){ + alert("保证金和首付款和不在产品配置的值内!!!"); + return; + } + } // 如果是不规则租金测算的话,那么仅保存商务报价。 diff --git a/WebContent/WEB-INF/etc/app/component/component-config.xml b/WebContent/WEB-INF/etc/app/component/component-config.xml index fa4302cd8..b5959cfc1 100644 --- a/WebContent/WEB-INF/etc/app/component/component-config.xml +++ b/WebContent/WEB-INF/etc/app/component/component-config.xml @@ -1,434 +1,434 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml index 2c9e1fa9f..51376d906 100644 --- a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml +++ b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml @@ -196,4 +196,4 @@ - \ No newline at end of file + \ No newline at end of file From 493dfaa68dff4f505d2789a1731fe6e0c2fcdd96 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Fri, 29 Jan 2021 15:58:52 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ROA=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=97=A5=E5=BF=97=E5=92=8C=E9=99=84=E4=BB=B6=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calc/com/tenwa/reckon/help/ConditionHelper.java | 3 ++- src_core/com/tenwa/doc/action/DocListInitAction.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/calc/com/tenwa/reckon/help/ConditionHelper.java b/calc/com/tenwa/reckon/help/ConditionHelper.java index 9f6746e00..4b2e8df20 100644 --- a/calc/com/tenwa/reckon/help/ConditionHelper.java +++ b/calc/com/tenwa/reckon/help/ConditionHelper.java @@ -169,7 +169,8 @@ public class ConditionHelper { .append(",手续费税率:").append(handRate).append(",GPS差额:").append(gpsDifference).append(",GPS差额税率:").append(gpsInstallFee) .append(",租金表里成本和:").append(costMoney).append(",保证金金额:").append(cb.getCautionMoney()).append(",租赁年限:").append(leaseTerm) .append(",成本利率:").append(CostInterestRate).append(",租金税率:").append(rentRate).append(",融资金额:").append(cleanLeaseMoney) - .append(",运营费率:").append(new BigDecimal( operatingRate ).divide( percentage ) ).append(",风险计提比率:").append( new BigDecimal( riskAccrualRatio ).divide( percentage ) ); + .append(",运营费率:").append(new BigDecimal( operatingRate ).divide( percentage ) ).append(",风险计提比率:").append( new BigDecimal( riskAccrualRatio ).divide( percentage ) ) + .append(",收入:").append(in).append(",成本:").append(cost).append(",运营费用:").append(operatingExpenses).append(",风险计提:").append(withdrawalRisk); System.out.println(sb.toString()); if ( roa.compareTo( new BigDecimal( roaValue ).divide( new BigDecimal("100") ) ) < 0 ) { throw new BusinessException( "ROA小于产品配置!" ); diff --git a/src_core/com/tenwa/doc/action/DocListInitAction.java b/src_core/com/tenwa/doc/action/DocListInitAction.java index 3edeadb88..7790924bd 100644 --- a/src_core/com/tenwa/doc/action/DocListInitAction.java +++ b/src_core/com/tenwa/doc/action/DocListInitAction.java @@ -493,6 +493,7 @@ public class DocListInitAction { BizObjectManager bomLDR = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME); BizObjectManager bomLDL = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME); BizObjectManager bomLDA = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME); + BizObject boLDR = null; List boListLDR = null; if(objecttype!=null){ @@ -503,10 +504,10 @@ public class DocListInitAction { .setParameter("proj_id", fbo==null?"":fbo.getAttribute("proj_id").getString()) .getResultList(false); }else if(objecttype!=""){ - boLDR = bomLDR.createQuery("flow_unid =:flowunid and objecttype=:objecttype") + boListLDR = bomLDR.createQuery("flow_unid =:flowunid and objecttype=:objecttype") .setParameter("flowunid", flowunid) .setParameter("objecttype", objecttype) - .getSingleResult(false); + .getResultList(false); }else{ boLDR = bomLDR.createQuery("flow_unid =:flowunid and objecttype is null") .setParameter("flowunid", flowunid)