From 17d27d75ba1175a403c1ab1faa525b920bca7bb8 Mon Sep 17 00:00:00 2001 From: "chaojie.li" Date: Wed, 11 Dec 2024 17:27:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=9A=E6=81=AF=E5=87=8F=E5=85=8D=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E6=B5=81=E7=A8=8B=E5=AE=A1=E6=89=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E3=80=90=E7=A7=9F=E9=87=91=E5=9B=9E=E7=AC=BC=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E3=80=91=E9=A1=B5=E9=9D=A2=E5=8A=A0=E8=BD=BD=E9=80=9F=E5=BA=A6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PenaltyReductionApplyList.jsp | 2 +- .../VILCRentPlanForReductionList.jsp | 141 +++++++++--------- config/fenix/flow/PenaltyReductionFlow.xml | 107 +++++++++++++ src_core/com/tenwa/util/SqlRunnerUtil.java | 60 ++++++++ .../page/RentPlanListHtmlGenerator.java | 85 +++++++++++ 5 files changed, 325 insertions(+), 70 deletions(-) create mode 100644 config/fenix/flow/PenaltyReductionFlow.xml create mode 100644 src_core/com/tenwa/util/SqlRunnerUtil.java create mode 100644 src_tenwa/com/tenwa/flow/rent/penalty_reduction/page/RentPlanListHtmlGenerator.java diff --git a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/PenaltyReductionApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/PenaltyReductionApplyList.jsp index 845ee9735..5e5d075b0 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/PenaltyReductionApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/PenaltyReductionApplyList.jsp @@ -20,7 +20,7 @@ } } - AsDialog.OpenSelector("SelectPaymentHavePenaltyNew","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectPaymentHavePenalty","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/VILCRentPlanForReductionList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/VILCRentPlanForReductionList.jsp index da0b6effe..909cf3400 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/VILCRentPlanForReductionList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/PenaltyReduction/VILCRentPlanForReductionList.jsp @@ -1,72 +1,75 @@ -<%@page import="java.math.BigDecimal"%> -<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> -<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS"%> -<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP"%> -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% - - String phaseNo = CurPage.getParameter("PhaseNo"); - String flowunid = CurPage.getParameter("FlowUnid"); - String rightType = CurPage.getParameter("RightType"); - String paymentNumber = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid") - .setParameter("flowunid", flowunid).getSingleResult(false).getAttribute("flow_key").getString(); - ASObjectModel doTemp = new ASObjectModel("VILCRentPlanForReductionList"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- - dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.MultiSelect = true; - if("ReadOnly".equals(rightType)){ - dwTemp.MultiSelect = false; - } - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(paymentNumber); +<%@page import="java.math.BigDecimal" %> +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT" %> +<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS" %> +<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP" %> +<%@ page contentType="text/html; charset=GBK" %> +<%@ include file="/Frame/resources/include/include_begin_list.jspf" %> +<% - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"ReadOnly".equals(rightType)?"false":"true","","Button","生成罚息减免","生成罚息减免","createPenaltyAdjust()","","","","btn_icon_add",""} - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + String phaseNo = CurPage.getParameter("PhaseNo"); + String flowunid = CurPage.getParameter("FlowUnid"); + String rightType = CurPage.getParameter("RightType"); + String paymentNumber = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid") + .setParameter("flowunid", flowunid).getSingleResult(false).getAttribute("flow_key").getString(); + ASObjectModel doTemp = new ASObjectModel("VILCRentPlanForReductionList"); + doTemp.setDataQueryClass("com.tenwa.flow.rent.penalty_reduction.page.RentPlanListHtmlGenerator"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, request); + dwTemp.Style = "1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.MultiSelect = true; + if ("ReadOnly".equals(rightType)) { + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(paymentNumber); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"ReadOnly".equals(rightType) ? "false" : "true", "", "Button", "生成罚息减免", "生成罚息减免", "createPenaltyAdjust()", "", "", "", "btn_icon_add", ""} + }; +%> +<%@include file="/Frame/resources/include/ui/include_list.jspf" %> -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ include file="/Frame/resources/include/include_end.jspf" %> \ No newline at end of file diff --git a/config/fenix/flow/PenaltyReductionFlow.xml b/config/fenix/flow/PenaltyReductionFlow.xml new file mode 100644 index 000000000..c3ee35127 --- /dev/null +++ b/config/fenix/flow/PenaltyReductionFlow.xml @@ -0,0 +1,107 @@ + + + + + select lcf.ID AS id, + lbc.PROJECT_ID AS project_id, + lbc.ID AS contract_id, + lbc.CONTRACT_STATUS AS contract_status, + lbc.BUSINESSTYPE AS businesstype, + lbc.SUBJECTID AS subjectid, + lbc.distributor_id AS distributor_id, + lbc.CONTRACT_NUMBER AS contract_number, + lcf.PAYMENT_NUMBER AS payment_number, + ifnull(lbu.customername, '') AS customername, + lbc.PROJECT_NAME AS project_name, + lcf.PLAN_LIST AS plan_list, + lcf.PLAN_DATE AS plan_date, + lcf.RENT AS rent, + lcf.CORPUS AS corpus, + lcf.INTEREST AS interest, + getRentPenalty(lcf.PAYMENT_NUMBER, lcf.PLAN_LIST, date_format(now(), '%Y/%m/%d')) AS penalty, + (ifnull(lcfd.rent, 0) + ifnull(lcfi.rent, 0)) AS fact_rent, + (ifnull(lcfd.corpus, 0) + ifnull(lcfi.corpus, 0)) AS fact_corpus, + (ifnull(lcfd.interest, 0) + ifnull(lcfi.interest, 0)) AS fact_interest, + (ifnull(lcfd.penalty, 0) + ifnull(lcfi.penalty, 0)) AS fact_penalty, + (ifnull(lcfd.corpus_adjust, 0) + ifnull(lcfi.corpus_adjust, 0)) AS corpus_adjust, + (ifnull(lcfd.interest_adjust, 0) + ifnull(lcfi.interest_adjust, 0)) AS interest_adjust, + (ifnull(lcfd.penalty_adjust, 0) + ifnull(lcfi.penalty_adjust, 0)) AS penalty_adjust, + (lcf.RENT - (ifnull(lcfd.rent, 0) + ifnull(lcfi.rent, 0))) AS rent_over, + (lcf.CORPUS - + (((ifnull(lcfd.corpus, 0) + ifnull(lcfi.corpus, 0)) + ifnull(lcfd.corpus_adjust, 0)) + + ifnull(lcfi.corpus_adjust, 0))) AS corpus_over, + (lcf.INTEREST - + (((ifnull(lcfd.interest, 0) + ifnull(lcfi.interest, 0)) + ifnull(lcfd.interest_adjust, 0)) + + ifnull(lcfi.interest_adjust, 0))) AS interest_over, + round((getRentPenalty(lcf.PAYMENT_NUMBER, lcf.PLAN_LIST, date_format(now(), '%Y/%m/%d')) - + ((ifnull(lcfd.penalty, 0) + ifnull(lcfi.penalty, 0)) + + (ifnull(lcfd.penalty_adjust, 0) + ifnull(lcfi.penalty_adjust, 0)))), 2) AS penalty_over, + (case + when (((ifnull(lcfd.rent, 0) + ifnull(lcfi.rent, 0)) = lcf.RENT) and (round((getRentPenalty( + lcf.PAYMENT_NUMBER, + lcf.PLAN_LIST, + date_format(now(), '%Y/%m/%d')) - + ((ifnull(lcfd.penalty, 0) + ifnull(lcfi.penalty, 0)) + + (ifnull(lcfd.penalty_adjust, 0) + + ifnull(lcfi.penalty_adjust, 0)))), + 2) = '0.00')) + then '宸插洖绗' + when ((ifnull(lcfd.rent, 0) + ifnull(lcfi.rent, 0)) > 0) then '閮ㄥ垎鍥炵' + else '鏈洖绗' end) AS planstatus + from lc_rent_plan lcf + left join lb_contract_info lbc + on lcf.CONTRACT_ID = lbc.ID + left join lc_calc_condition_status lccs + on lccs.PAYMENT_NUMBER = lcf.PAYMENT_NUMBER + left join lb_union_lessee_transfer lbu + on lcf.CONTRACT_ID = lbu.contract_id + left join (select lc_rent_income.PAYMENT_NUMBER AS payment_number, + lc_rent_income.PLAN_LIST AS plan_list, + lc_rent_income.PLAN_ID AS plan_id, + sum(lc_rent_income.RENT) AS rent, + sum(lc_rent_income.CORPUS) AS corpus, + sum(lc_rent_income.INTEREST) AS interest, + sum(lc_rent_income.PENALTY) AS penalty, + sum(lc_rent_income.CORPUS_ADJUST) AS corpus_adjust, + sum(lc_rent_income.INTEREST_ADJUST) AS interest_adjust, + 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 + left join (select lc_rent_income_temp.PAYMENT_NUMBER AS payment_number, + lc_rent_income_temp.PLAN_LIST AS plan_list, + sum(lc_rent_income_temp.RENT) AS rent, + sum(lc_rent_income_temp.CORPUS) AS corpus, + sum(lc_rent_income_temp.INTEREST) AS interest, + sum(lc_rent_income_temp.PENALTY) AS penalty, + sum(lc_rent_income_temp.CORPUS_ADJUST) AS corpus_adjust, + sum(lc_rent_income_temp.INTEREST_ADJUST) AS interest_adjust, + sum(lc_rent_income_temp.PENALTY_ADJUST) AS penalty_adjust + 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} + + + + select round(getRentPenalty(lrp.PAYMENT_NUMBER, lrp.PLAN_LIST, date_format(now(), '%Y/%m/%d')) - + ifnull((select sum(lri.PENALTY + PENALTY_ADJUST) + from lc_rent_income lri + where lri.PAYMENT_NUMBER = lrp.PAYMENT_NUMBER + and lri.PLAN_LIST = lrp.PLAN_LIST + ), 0) - ifnull((select sum(lri.PENALTY + PENALTY_ADJUST) + from lc_rent_income_temp lri + where lri.PAYMENT_NUMBER = lrp.PAYMENT_NUMBER + and lri.PLAN_LIST = lrp.PLAN_LIST + ), 0), + 2) as plan_penalty + from lc_rent_plan lrp + where lrp.id = #{planId} + + \ No newline at end of file diff --git a/src_core/com/tenwa/util/SqlRunnerUtil.java b/src_core/com/tenwa/util/SqlRunnerUtil.java new file mode 100644 index 000000000..5c86e5aee --- /dev/null +++ b/src_core/com/tenwa/util/SqlRunnerUtil.java @@ -0,0 +1,60 @@ +package com.tenwa.util; + +import cn.hutool.db.*; +import cn.hutool.db.dialect.impl.MysqlDialect; +import cn.hutool.db.handler.RsHandler; +import cn.hutool.db.sql.SqlBuilder; +import cn.hutool.db.sql.SqlExecutor; +import com.amarsoft.are.sql.Connection; +import com.amarsoft.awe.util.Transaction; +import com.blinkfox.fenix.bean.SqlInfo; +import com.blinkfox.fenix.core.Fenix; + +import java.sql.SQLException; +import java.util.Map; + +/** + * @program: apzl_leasing + * @description: + * @author: 李超杰 + * @create: 2024-12-12 09:23 + */ +public class SqlRunnerUtil { + + private static SqlConnRunner sqlConnRunner = DbUtil.newSqlConnRunner(new MysqlDialect()); + + /** + * 分页查询 + * @param transaction + * @param fullFenixId + * @param paramMap + * @param page + * @return + * @throws SQLException + */ + public static PageResult page(Transaction transaction, String fullFenixId, Map paramMap, Page page) throws SQLException { + SqlInfo xmlSqlInfo = Fenix.getXmlSqlInfo(fullFenixId, paramMap); + Connection connection = transaction.getConnection(); + SqlBuilder sqlBuilder = SqlBuilder.of(xmlSqlInfo.getSql()); + sqlBuilder.addParams(xmlSqlInfo.getParams()); + return sqlConnRunner.page(connection, sqlBuilder, page); + } + + /** + * 查询对象、列表、值、值列表等 + * @param transaction + * @param fullFenixId + * @param paramMap + * @param rsh + * @return + * @param + * @throws SQLException + */ + public static T query(Transaction transaction, String fullFenixId, Map paramMap, RsHandler rsh) throws SQLException { + SqlInfo xmlSqlInfo = Fenix.getXmlSqlInfo(fullFenixId, paramMap); + Connection connection = transaction.getConnection(); + SqlBuilder sqlBuilder = SqlBuilder.of(xmlSqlInfo.getSql()); + sqlBuilder.addParams(xmlSqlInfo.getParams()); + return SqlExecutor.query(connection, sqlBuilder, rsh); + } +} diff --git a/src_tenwa/com/tenwa/flow/rent/penalty_reduction/page/RentPlanListHtmlGenerator.java b/src_tenwa/com/tenwa/flow/rent/penalty_reduction/page/RentPlanListHtmlGenerator.java new file mode 100644 index 000000000..ca34ecb6c --- /dev/null +++ b/src_tenwa/com/tenwa/flow/rent/penalty_reduction/page/RentPlanListHtmlGenerator.java @@ -0,0 +1,85 @@ +package com.tenwa.flow.rent.penalty_reduction.page; + +import cn.hutool.db.*; +import cn.hutool.db.dialect.impl.MysqlDialect; +import cn.hutool.db.sql.SqlBuilder; +import cn.hutool.db.sql.SqlExecutor; +import com.amarsoft.are.ARE; +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.sql.Connection; +import com.amarsoft.awe.dw.handler.BusinessProcessData; +import com.amarsoft.awe.dw.ui.htmlfactory.ListHtmlWithASDataObjectGenerator; +import com.amarsoft.awe.dw.ui.htmlfactory.QueryParamObject; +import com.amarsoft.awe.util.Transaction; +import com.blinkfox.fenix.bean.SqlInfo; +import com.blinkfox.fenix.core.Fenix; +import com.tenwa.util.SqlRunnerUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @program: apzl_leasing + * @description: + * @author: 李超杰 + * @create: 2024-12-06 10:24 + */ +public class RentPlanListHtmlGenerator extends ListHtmlWithASDataObjectGenerator { + + @Override + public void run(BusinessProcessData arg0) throws Exception { + this.asObj.setParamstr(this.paramstr); + System.out.println("SQL参数:" + this.paramstr); + System.out.println("分页参数:pageSize=" + this.pageSize + ",curPage=" + this.curPage + ",pageCount=" + this.pageCount + ",rowCount=" + + this.rowCount + ""); + //获得查询条件 + List queryParams = this.getQeuryParmObjects(); + for (QueryParamObject queryParam : queryParams) { + System.out.println("查询条件:[colname=" + queryParam.getColName() + ",option=" + queryParam.getOption() + ",value0=" + queryParam.getValue0() + + ",value1=" + queryParam.getValue1() + "]"); + } + + Transaction transaction = Transaction.createTransaction(JBOFactory.createJBOTransaction()); + try { + + Map paramMap = new HashMap<>(); + paramMap.put("paymentNumber", this.paramstr); + PageResult pageResult = SqlRunnerUtil.page(transaction, "flow.PenaltyReductionFlow.queryRentPlanList", paramMap, + Page.of(this.curPage, this.getPageSize())); + this.rowCount = pageResult.getTotal(); + this.pageCount = pageResult.getTotalPage(); + + BizObjectManager manager = getBizObjectManager(); + this.searchedDataList = new ArrayList(); + for (Entity entity : pageResult) { + this.searchedDataList.add(createBizObject(manager, entity)); + } + transaction.commit(); + } catch (Exception e) { + e.printStackTrace(); + try { + if (transaction != null) transaction.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + } finally { + try { + if (transaction != null) { + transaction.disConnect(); + } + } catch (JBOException e) { + e.printStackTrace(); + } + } + } + + @Override + public void calPageCount(BusinessProcessData businessProcessData) throws Exception { + pageCount = (rowCount + this.pageSize - 1) / this.pageSize; + } +}