diff --git a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/CheckPlanOverMoney.jsp b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/CheckPlanOverMoney.jsp index 6dcbd212d..2190fd013 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/CheckPlanOverMoney.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/CheckPlanOverMoney.jsp @@ -1,27 +1,38 @@ -<%@page import="com.amarsoft.are.jbo.BizObject"%> -<%@page import="jbo.app.tenwa.calc.VI_LC_RENT_PLAN"%> -<%@page import="com.amarsoft.are.jbo.JBOFactory"%> -<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> -<%@page import="java.math.BigDecimal"%> -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/IncludeBeginMDAJAX.jsp"%><% - String flowunid = CurPage.getParameter("flowunid"); - String planIDs = CurPage.getParameter("planIDs"); - String overPenaltys = CurPage.getParameter("overPenaltys"); - String[] planID = planIDs.split("@"); - String[] overPenalty = overPenaltys.split("@"); - boolean flag = true; - for(int i=0;i<%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file +<%@page import="com.amarsoft.are.jbo.BizObject" %> +<%@page import="jbo.app.tenwa.calc.VI_LC_RENT_PLAN" %> +<%@page import="com.amarsoft.are.jbo.JBOFactory" %> +<%@page import="com.amarsoft.are.jbo.JBOTransaction" %> +<%@page import="java.math.BigDecimal" %> +<%@ page import="com.tenwa.util.SqlRunnerUtil" %> +<%@ page import="com.google.common.collect.ImmutableMap" %> +<%@ page import="cn.hutool.db.handler.NumberHandler" %> +<%@ page contentType="text/html; charset=GBK" %> +<%@ include file="/IncludeBeginMDAJAX.jsp" %> +<% + String flowunid = CurPage.getParameter("flowunid"); + String planIDs = CurPage.getParameter("planIDs"); + String overPenaltys = CurPage.getParameter("overPenaltys"); + String[] planID = planIDs.split("@"); + String[] overPenalty = overPenaltys.split("@"); + boolean flag = true; + Map paramMap = new HashMap<>(); + for (int i = 0; i < planID.length; i++) { + paramMap.put("planId", planID[i]); + BigDecimal overPenaltyTmp = (BigDecimal) SqlRunnerUtil.query(Sqlca, "flow.PenaltyReductionFlow.queryRentPlanRemainPenalty", paramMap, new NumberHandler()); + if (new BigDecimal(overPenalty[i]).compareTo(overPenaltyTmp) != 0) { + flag = false; + } +// String sql = "select case when penalty_over!='"+overPenalty[i]+"' then 0 else 1 end from vi_lc_rent_plan where id='"+planID[i]+"'"; +// SqlObject so = new SqlObject(sql); +// String result = Sqlca.getString(so); +// if("0".equals(result)){ +// flag = false; +// } + } + if (!flag) { + out.println("ERROR"); + } else { + out.println("SUCCESS"); + } +%> +<%@ include file="/IncludeEndAJAX.jsp" %> \ No newline at end of file diff --git a/config/fenix/flow/PenaltyReductionFlow.xml b/config/fenix/flow/PenaltyReductionFlow.xml index c3ee35127..59797b7ad 100644 --- a/config/fenix/flow/PenaltyReductionFlow.xml +++ b/config/fenix/flow/PenaltyReductionFlow.xml @@ -1,5 +1,5 @@ - + select lcf.ID AS id, @@ -67,7 +67,8 @@ sum(lc_rent_income.PENALTY_ADJUST) AS penalty_adjust from lc_rent_income where lc_rent_income.ROLL_BACK = '0' - and PAYMENT_NUMBER = #{paymentNumber} + + group by lc_rent_income.PAYMENT_NUMBER, lc_rent_income.PLAN_LIST) lcfd on lcf.PAYMENT_NUMBER = lcfd.payment_number and lcf.PLAN_LIST = lcfd.plan_list @@ -83,10 +84,14 @@ from lc_rent_income_temp where lc_rent_income_temp.IS_FLOWING = 0 and lc_rent_income_temp.ROLL_BACK = '0' - and PAYMENT_NUMBER = #{paymentNumber} + + group by lc_rent_income_temp.PAYMENT_NUMBER, lc_rent_income_temp.PLAN_LIST) lcfi on lcf.PAYMENT_NUMBER = lcfi.payment_number and lcf.PLAN_LIST = lcfi.plan_list - where lcf.PAYMENT_NUMBER = #{paymentNumber} + + + + @@ -100,7 +105,7 @@ where lri.PAYMENT_NUMBER = lrp.PAYMENT_NUMBER and lri.PLAN_LIST = lrp.PLAN_LIST ), 0), - 2) as plan_penalty + 2) as over_penalty from lc_rent_plan lrp where lrp.id = #{planId} diff --git a/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java b/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java index 04c44431e..2449013c2 100644 --- a/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java +++ b/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java @@ -11,6 +11,9 @@ import java.util.Date; import java.util.List; import java.util.Map; +import cn.hutool.db.handler.NumberHandler; +import com.google.common.collect.ImmutableMap; +import com.tenwa.util.SqlRunnerUtil; import org.springframework.web.context.ContextLoader; import org.springframework.web.context.WebApplicationContext; @@ -766,26 +769,28 @@ public class RentIncomeMethod { /** * Ϣ */ - public String setPenaltyDataToRentIncome(JBOTransaction tx) throws JBOException{ - try{ - String[] Penaltys = overPenaltys.split("@"); - Boolean flag = false; - if("Y".equals(isChanged)){ - flag = true; - } + public String setPenaltyDataToRentIncome(JBOTransaction tx) throws JBOException { + try { +// String[] Penaltys = overPenaltys.split("@"); +// Boolean flag = false; +// if ("Y".equals(isChanged)) { +// flag = true; +// } String[] ids = planIDs.split("@"); - for(int i=0;i boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0'").setParameter("PLAN_ID", ids[i]) + List boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PAYMENT_NUMBER=:paymentNumber AND PLAN_LIST = :planList and ROLL_BACK='0'") + .setParameter("paymentNumber", boVLR.getAttribute(LC_RENT_PLAN.PAYMENT_NUMBER).getString()) + .setParameter("planList", boVLR.getAttribute(LC_RENT_PLAN.PLAN_LIST).getString()) .getResultList(false); - List boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = 0 and ROLL_BACK='0'").setParameter("PLAN_ID", ids[i]) + List boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PAYMENT_NUMBER=:paymentNumber AND PLAN_LIST = :planList and IS_FLOWING = 0 and ROLL_BACK='0'") + .setParameter("paymentNumber", boVLR.getAttribute(LC_RENT_PLAN.PAYMENT_NUMBER).getString()) + .setParameter("planList", boVLR.getAttribute(LC_RENT_PLAN.PLAN_LIST).getString()) .getResultList(false); - boLRIT.setAttributeValue("HIRE_LIST", boLCRI.size()+boLCRIT.size()+1); + boLRIT.setAttributeValue("HIRE_LIST", boLCRI.size() + boLCRIT.size() + 1); boLRIT.setAttributeValue("HIRE_DATE", StringFunction.getToday()); boLRIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday()); boLRIT.setAttributeValue("RENT", 0); @@ -816,14 +825,14 @@ public class RentIncomeMethod { boLRIT.setAttributeValue("INTEREST_ADJUST", 0); boLRIT.setAttributeValue("PENALTY", 0); boLRIT.setAttributeValue("CORPUS_ADJUST", 0); - boLRIT.setAttributeValue("PENALTY_ADJUST", flag?boVLRP.getAttribute("PENALTY_OVER").getString():Penaltys[i]); + boLRIT.setAttributeValue("PENALTY_ADJUST", penaltyOver); boLRIT.setAttributeValue("ROLL_BACK", 0); boLRIT.setAttributeValue("COIN", boVLR.getAttribute("COIN").getString()); boLRIT.setAttributeValue("IS_FLOWING", 0); boLRIT.setAttributeValue("FLOWUNID", flowunid); boLRI.saveObject(boLRIT); } - }catch(Exception e){ + } catch (Exception e) { e.printStackTrace(); return "ERROR"; }