Commit 3027a19d by 王德峰

资产追加-sql完成,待进一步开发

parent 6db4fb32
...@@ -419,6 +419,37 @@ ...@@ -419,6 +419,37 @@
AND R3.AST_POOL_NO=#{astPoolNo,jdbcType=VARCHAR} AND R3.AST_POOL_NO=#{astPoolNo,jdbcType=VARCHAR}
</operation> </operation>
<operation name="getLoanListForPackAddAst" resultmap="AstPoolLoan" multiplicity="paging" paging="AstPackLoan" remark="根据资产池编号查询对应的资产">
<extraparams>
<param name="screenRuleList" javatype="java.util.List&lt;com.abssqr.plat.common.facade.model.rule.AstScreenRule&gt;"/>
<param name="astType" javatype="com.abssqr.plat.common.facade.enums.AstTypeEnum"/>
</extraparams>
SELECT
L1.AST_NO, --资产编号
L1.PRIN_BAL, --贷款剩余本金
L1.START_DATE, --贷款日期
L1.TERM_CNT-L1.CUR_TERM AS FREE_TERM, --贷款剩余期限
R1.RATE, --贷款利率
L1.RISK_CL, --五级分类
R1.REPAY_PERIOD, --还款周期
R1.REPAY_PERIOD_TYPE, --还款周期类型
R1.REPAY_METHOD, --还款方式
R4.PLAN_NAME --资产归属
FROM
ABS_LOAN L1
UNION (
<if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK">
<include refid="ABS_LOAN_PACK_REL.QCDK_SQL"/>
</if>
) u ON L1.ast_no=u.ast_no
LEFT JOIN ABS_LOAN_CONTRACT R1 ON L1.AST_NO=R1.AST_NO
LEFT JOIN ABS_LOAN_PACK_REL R2 ON L1.AST_NO=R2.AST_NO
LEFT JOIN ABS_AST_PACK R3 ON R2.PACK_NO=R3.PACK_NO
LEFT JOIN ABS_PLAN R4 ON R3.PLAN_NO=R4.PLAN_NO
WHERE
R2.STATUS='in'
AND R3.AST_POOL_NO=#{astPoolNo,jdbcType=VARCHAR}
</operation>
<operation name="getLoanPageByPackNo" multiplicity="paging" paging="PackAst" remark="根据资产包编号分页获取所有的资产"> <operation name="getLoanPageByPackNo" multiplicity="paging" paging="PackAst" remark="根据资产包编号分页获取所有的资产">
SELECT sf.* SELECT sf.*
......
...@@ -155,20 +155,25 @@ ...@@ -155,20 +155,25 @@
<extraparams> <extraparams>
<param name="screenRuleList" javatype="java.util.List&lt;com.abssqr.plat.common.facade.model.rule.AstScreenRule&gt;"/> <param name="screenRuleList" javatype="java.util.List&lt;com.abssqr.plat.common.facade.model.rule.AstScreenRule&gt;"/>
<param name="astType" javatype="com.abssqr.plat.common.facade.enums.AstTypeEnum"/> <param name="astType" javatype="com.abssqr.plat.common.facade.enums.AstTypeEnum"/>
<param name="avalAmt" javatype="com.general.system.common.model.Money"/>
</extraparams> </extraparams>
update abs_loan_pack_rel update abs_loan_pack_rel
set PACK_NO = #{packNo,jdbcType=VARCHAR} set PACK_NO = #{packNo,jdbcType=VARCHAR}
where where
PACK_NO = #{astPoolNo,jdbcType=VARCHAR} PACK_NO = #{astPoolNo,jdbcType=VARCHAR}
AND ast_no in( AND ast_no in(
select
ast_no
from(
<if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK"> <if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK">
<include refid="QCDK_SQL"/> <include refid="QCDK_SQL"/>
</if> </if>
)where
sum_bal &lt;= ${avalAmt,jdbcType=DECIMAL}
) )
</operation> </operation>
<sql id="QCDK_SQL"> <sql id="QCDK_SQL">
SELECT l.ast_no SELECT l.ast_no,sum(l.prin_bal)OVER(order by l.ast_no desc) sum_bal
FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc
WHERE WHERE
l.ast_no = rel.ast_no l.ast_no = rel.ast_no
...@@ -176,28 +181,58 @@ ...@@ -176,28 +181,58 @@
AND rel.status = 'in' AND rel.status = 'in'
AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR} AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR}
<foreach collection="screenRuleList" item="rule"> <foreach collection="screenRuleList" item="rule">
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RISK_TYPE"> <choose>
<!-- 五级分类 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RISK_TYPE">
AND l.RISK_CL in AND l.RISK_CL in
<foreach collection="rule.listVal" item="val" open="(" separator="," close=")"> <foreach collection="rule.listVal" item="val" open="(" separator="," close=")">
#{val,jdbcType=VARCHAR} #{val,jdbcType=VARCHAR}
</foreach> </foreach>
</if> </when>
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_DISB_DATE"> <!-- 贷款发放日 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_DISB_DATE">
<if test="rule.leftCondition != null"> <if test="rule.leftCondition != null">
AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
<if test="rule.rightCondition != null"> <if test="rule.rightCondition != null">
AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
</if> </when>
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_END_DATE"> <!-- 贷款到期日 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_END_DATE">
<if test="rule.leftCondition != null"> <if test="rule.leftCondition != null">
AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
<if test="rule.rightCondition != null"> <if test="rule.rightCondition != null">
AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
</when>
<!-- 执行利率 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_LOAN_RATE">
<if test="rule.leftCondition != null">
AND lc.RATE ${rule.leftCondition.code} to_number(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if>
<if test="rule.rightCondition != null">
AND lc.RATE ${rule.rightCondition.code} to_number(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
</when>
<!-- 还款频率 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_REPAY_FREQ">
<if test="rule.rightCondition != null">
AND lc.REPAY_PERIOD ${rule.rightCondition.code} #{rule.rightValue,jdbcType=VARCHAR}
</if>
</when>
<!-- 利率类型 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RATE_TYPE">
<if test="rule.rightCondition != null">
AND lc.RATE_TYPE ${rule.rightCondition.code} #{rule.rightValue,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
@failure
</otherwise>
</choose>
</foreach> </foreach>
</sql> </sql>
</table> </table>
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
result.setFeeName(param.getFeeName()); result.setFeeName(param.getFeeName());
//feeCalcType 计费方式 //feeCalcType 计费方式
result.setFeeCalcType(param.getFeeCalcType()); result.setFeeCalcType(param.getFeeCalcType());
//feeTimeType 默认计费时间
result.setFeeTimeType(param.getFeeTimeType());
//feeScaleType 费用基准 //feeScaleType 费用基准
result.setFeeScaleType(param.getFeeScaleType()); result.setFeeScaleType(param.getFeeScaleType());
//gmtCreate 创建时间 //gmtCreate 创建时间
result.setGmtCreate(param.getGmtCreate()); result.setGmtCreate(param.getGmtCreate());
//gmtModified 更新时间 //gmtModified 更新时间
result.setGmtModified(param.getGmtModified()); result.setGmtModified(param.getGmtModified());
//feeCalcDefaultDate 默认计费时间
result.setFeeCalcDefaultDate(param.getFeeCalcDefaultDate());
//feeRate 费率 //feeRate 费率
result.setFeeRate(param.getFeeRate()); result.setFeeRate(param.getFeeRate());
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
//planNo 产品编号 //planNo 产品编号
//feeName 费用名称 //feeName 费用名称
//feeCalcType 计费方式 //feeCalcType 计费方式
//feeTimeType 默认计费时间
//feeScaleType 费用基准 //feeScaleType 费用基准
//gmtCreate 创建时间 //gmtCreate 创建时间
//gmtModified 更新时间 //gmtModified 更新时间
//feeCalcDefaultDate 默认计费时间
//feeRate 费率 //feeRate 费率
} }
...@@ -92,18 +92,13 @@ public class AbssqrCoreConstants{ ...@@ -92,18 +92,13 @@ public class AbssqrCoreConstants{
public static final String tableName="ABS_LOAN_PACK_REL"; public static final String tableName="ABS_LOAN_PACK_REL";
public static final String Base_SF_Column_List = "sf.BACK_COST,sf.BACK_PRIN,sf.AST_NO,sf.BACK_NO,sf.PACK_NO ,sf.STATUS,sf.GMT_CREATE,sf.GMT_MODIFIED,sf.REPAY_FINAL_DATE,sf.BACK_RATE"; public static final String Base_SF_Column_List = "sf.BACK_COST,sf.BACK_PRIN,sf.AST_NO,sf.BACK_NO,sf.PACK_NO ,sf.STATUS,sf.GMT_CREATE,sf.GMT_MODIFIED,sf.REPAY_FINAL_DATE,sf.BACK_RATE";
public static final String Base_Column_List = "BACK_COST,BACK_PRIN,AST_NO,BACK_NO,PACK_NO ,STATUS,GMT_CREATE,GMT_MODIFIED,REPAY_FINAL_DATE,BACK_RATE"; public static final String Base_Column_List = "BACK_COST,BACK_PRIN,AST_NO,BACK_NO,PACK_NO ,STATUS,GMT_CREATE,GMT_MODIFIED,REPAY_FINAL_DATE,BACK_RATE";
public static final String QCDK_SQL = "SELECT ast_no FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc WHERE l.ast_no = rel.ast_no AND rel.ast_no = lc.ast_no AND rel.status = 'in' AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR}"; public static final String QCDK_SQL = "SELECT l.ast_no,sum(l.prin_bal)OVER(order by l.ast_no desc) sum_bal FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc WHERE l.ast_no = rel.ast_no AND rel.ast_no = lc.ast_no AND rel.status = 'in' AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR}";
} }
public static class ABS_PLAN_REPORT_ENTITY_STAT{ public static class ABS_PLAN_REPORT_ENTITY_STAT{
public static final String tableName="ABS_PLAN_REPORT_ENTITY_STAT"; public static final String tableName="ABS_PLAN_REPORT_ENTITY_STAT";
public static final String Base_SF_Column_List = "sf.AST_CHG,sf.FEE_AMT,sf.INTR_AMT,sf.PRIN_AMT,sf.OVD_FEE_AMT ,sf.OVD_INTR_AMT,sf.OVD_PRIN_AMT,sf.FEE_PENAL_AMT,sf.INTR_PENAL_AMT,sf.PRIN_PENAL_AMT ,sf.PLAN_NO,sf.STAT_VAL,sf.STAT_TYPE,sf.EVENT_CODE,sf.ACCOUNT_DATE,sf.COST,sf.ORG_DISTPFT_AMT"; public static final String Base_SF_Column_List = "sf.AST_CHG,sf.FEE_AMT,sf.INTR_AMT,sf.PRIN_AMT,sf.OVD_FEE_AMT ,sf.OVD_INTR_AMT,sf.OVD_PRIN_AMT,sf.FEE_PENAL_AMT,sf.INTR_PENAL_AMT,sf.PRIN_PENAL_AMT ,sf.PLAN_NO,sf.STAT_VAL,sf.STAT_TYPE,sf.EVENT_CODE,sf.ACCOUNT_DATE,sf.COST,sf.ORG_DISTPFT_AMT";
public static final String Base_Column_List = "AST_CHG,FEE_AMT,INTR_AMT,PRIN_AMT,OVD_FEE_AMT ,OVD_INTR_AMT,OVD_PRIN_AMT,FEE_PENAL_AMT,INTR_PENAL_AMT,PRIN_PENAL_AMT ,PLAN_NO,STAT_VAL,STAT_TYPE,EVENT_CODE,ACCOUNT_DATE,ORG_DISTPFT_AMT,COST"; public static final String Base_Column_List = "AST_CHG,FEE_AMT,INTR_AMT,PRIN_AMT,OVD_FEE_AMT ,OVD_INTR_AMT,OVD_PRIN_AMT,FEE_PENAL_AMT,INTR_PENAL_AMT,PRIN_PENAL_AMT ,PLAN_NO,STAT_VAL,STAT_TYPE,EVENT_CODE,ACCOUNT_DATE,ORG_DISTPFT_AMT,COST";
} }
public static class ABS_PLAN_ALLOC_ITEM{
public static final String tableName="ABS_PLAN_ALLOC_ITEM";
public static final String Base_SF_Column_List = "sf.ID,sf.SORT,sf.ITEM_NO,sf.PLAN_NO,sf.ALLOC_NO ,sf.TITLE_NO,sf.ALLOC_TYPE,sf.TITLE_NAME,sf.GMT_CREATE,sf.GMT_MODIFIED";
public static final String Base_Column_List = "ID,SORT,ITEM_NO,PLAN_NO,ALLOC_NO ,TITLE_NO,ALLOC_TYPE,TITLE_NAME,GMT_CREATE,GMT_MODIFIED";
}
public static class ABS_AST_PRICE_RULE{ public static class ABS_AST_PRICE_RULE{
public static final String tableName="ABS_AST_PRICE_RULE"; public static final String tableName="ABS_AST_PRICE_RULE";
public static final String Base_SF_Column_List = "sf.ID,sf.RISK_CL,sf.ABSSQR_PROD_CODE,sf.GMT_CREATE,sf.GMT_MODIFIED ,sf.INTR_RATE,sf.PRIN_RATE,sf.PENAL_FEE_RATE"; public static final String Base_SF_Column_List = "sf.ID,sf.RISK_CL,sf.ABSSQR_PROD_CODE,sf.GMT_CREATE,sf.GMT_MODIFIED ,sf.INTR_RATE,sf.PRIN_RATE,sf.PENAL_FEE_RATE";
......
...@@ -10,6 +10,7 @@ import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstMatchPage; ...@@ -10,6 +10,7 @@ import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstMatchPage;
import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstUnMatchPage; import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstUnMatchPage;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoanStat; import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoanStat;
import com.abssqr.plat.common.dal.mysql.auto.paging.AstPoolLoanPage; import com.abssqr.plat.common.dal.mysql.auto.paging.AstPoolLoanPage;
import com.abssqr.plat.common.dal.mysql.auto.paging.AstPackLoanPage;
import com.abssqr.plat.common.dal.mysql.auto.paging.PackAstPage; import com.abssqr.plat.common.dal.mysql.auto.paging.PackAstPage;
import com.abssqr.plat.common.dal.mysql.auto.mapper.LoanDOMapper; import com.abssqr.plat.common.dal.mysql.auto.mapper.LoanDOMapper;
...@@ -171,6 +172,22 @@ public class LoanDAO{ ...@@ -171,6 +172,22 @@ public class LoanDAO{
return astPoolLoan; return astPoolLoan;
} }
/** /**
* desc:根据资产池编号查询对应的资产.<br/>
* @param astPackLoan astPackLoan
* @return AstPackLoanPage
*/
public AstPackLoanPage getLoanListForPackAddAst(AstPackLoanPage astPackLoan){
int total = loanDOMapper.getLoanListForPackAddAstCount(astPackLoan);
if(total>0){
astPackLoan.setDatas(loanDOMapper.getLoanListForPackAddAstResult(astPackLoan));
}else{
astPackLoan.setDatas(new ArrayList());
}
astPackLoan.setTotal(total);
return astPackLoan;
}
/**
* desc:根据资产包编号分页获取所有的资产.<br/> * desc:根据资产包编号分页获取所有的资产.<br/>
* @param packAst packAst * @param packAst packAst
* @return PackAstPage * @return PackAstPage
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary; import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule; import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.abssqr.plat.common.facade.enums.AstTypeEnum; import com.abssqr.plat.common.facade.enums.AstTypeEnum;
import com.general.system.common.model.Money;
import com.abssqr.plat.common.dal.mysql.auto.mapper.LoanPackRelDOMapper; import com.abssqr.plat.common.dal.mysql.auto.mapper.LoanPackRelDOMapper;
/** /**
...@@ -91,6 +92,7 @@ public class LoanPackRelDAO{ ...@@ -91,6 +92,7 @@ public class LoanPackRelDAO{
} }
/** /**
* desc:筛选.<br/> * desc:筛选.<br/>
* @param avalAmt avalAmt
* @param packNo packNo * @param packNo packNo
* @param astPoolNo astPoolNo * @param astPoolNo astPoolNo
* @param astType astType * @param astType astType
...@@ -98,8 +100,8 @@ public class LoanPackRelDAO{ ...@@ -98,8 +100,8 @@ public class LoanPackRelDAO{
* @return int * @return int
*/ */
public int updateForScreen(String packNo,String astPoolNo,AstTypeEnum astType,List<AstScreenRule> screenRuleList){ public int updateForScreen(Money avalAmt,String packNo,String astPoolNo,AstTypeEnum astType,List<AstScreenRule> screenRuleList){
if(screenRuleList!=null && screenRuleList.size()>201){throw new RuntimeException("screenRuleList 超出201长度限制");} if(screenRuleList!=null && screenRuleList.size()>201){throw new RuntimeException("screenRuleList 超出201长度限制");}
return loanPackRelDOMapper.updateForScreen(packNo, astPoolNo, astType, screenRuleList); return loanPackRelDOMapper.updateForScreen(avalAmt, packNo, astPoolNo, astType, screenRuleList);
} }
} }
...@@ -41,6 +41,10 @@ public class PlanFeeStructureDO{ ...@@ -41,6 +41,10 @@ public class PlanFeeStructureDO{
*/ */
private String feeCalcType; private String feeCalcType;
/** /**
* feeTimeType 默认计费时间.
*/
private String feeTimeType;
/**
* feeScaleType 费用基准. * feeScaleType 费用基准.
*/ */
private String feeScaleType; private String feeScaleType;
...@@ -53,10 +57,6 @@ public class PlanFeeStructureDO{ ...@@ -53,10 +57,6 @@ public class PlanFeeStructureDO{
*/ */
private Date gmtModified; private Date gmtModified;
/** /**
* feeCalcDefaultDate 默认计费时间.
*/
private Date feeCalcDefaultDate;
/**
* feeRate 费率. * feeRate 费率.
*/ */
private BigDecimal feeRate; private BigDecimal feeRate;
...@@ -190,6 +190,22 @@ public class PlanFeeStructureDO{ ...@@ -190,6 +190,22 @@ public class PlanFeeStructureDO{
} }
/** /**
* Set feeTimeType 默认计费时间.
*/
public void setFeeTimeType(String feeTimeType){
this.feeTimeType = feeTimeType;
}
/**
* Get feeTimeType 默认计费时间.
*
* @return the string
*/
public String getFeeTimeType(){
return feeTimeType;
}
/**
* Set feeScaleType 费用基准. * Set feeScaleType 费用基准.
*/ */
public void setFeeScaleType(String feeScaleType){ public void setFeeScaleType(String feeScaleType){
...@@ -238,22 +254,6 @@ public class PlanFeeStructureDO{ ...@@ -238,22 +254,6 @@ public class PlanFeeStructureDO{
} }
/** /**
* Set feeCalcDefaultDate 默认计费时间.
*/
public void setFeeCalcDefaultDate(Date feeCalcDefaultDate){
this.feeCalcDefaultDate = feeCalcDefaultDate;
}
/**
* Get feeCalcDefaultDate 默认计费时间.
*
* @return the string
*/
public Date getFeeCalcDefaultDate(){
return feeCalcDefaultDate;
}
/**
* Set feeRate 费率. * Set feeRate 费率.
*/ */
public void setFeeRate(BigDecimal feeRate){ public void setFeeRate(BigDecimal feeRate){
......
...@@ -10,6 +10,7 @@ import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstUnMatchPage; ...@@ -10,6 +10,7 @@ import com.abssqr.plat.common.dal.mysql.auto.paging.CapitalAstUnMatchPage;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoanStat; import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoanStat;
import com.abssqr.plat.common.dal.mysql.auto.paging.AstPoolLoanPage; import com.abssqr.plat.common.dal.mysql.auto.paging.AstPoolLoanPage;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoan; import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoan;
import com.abssqr.plat.common.dal.mysql.auto.paging.AstPackLoanPage;
import com.abssqr.plat.common.dal.mysql.auto.paging.PackAstPage; import com.abssqr.plat.common.dal.mysql.auto.paging.PackAstPage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -125,6 +126,18 @@ public interface LoanDOMapper{ ...@@ -125,6 +126,18 @@ public interface LoanDOMapper{
*/ */
List<AstPoolLoan> getLoanListByAstPoolNoResult(AstPoolLoanPage astPoolLoan); List<AstPoolLoan> getLoanListByAstPoolNoResult(AstPoolLoanPage astPoolLoan);
/** /**
* desc:根据资产池编号查询对应的资产.<br/>
* @param astPackLoan astPackLoan
* @return int
*/
int getLoanListForPackAddAstCount(AstPackLoanPage astPackLoan);
/**
* desc:根据资产池编号查询对应的资产.<br/>
* @param astPackLoan astPackLoan
* @return List<AstPoolLoan>
*/
List<AstPoolLoan> getLoanListForPackAddAstResult(AstPackLoanPage astPackLoan);
/**
* desc:根据资产包编号分页获取所有的资产.<br/> * desc:根据资产包编号分页获取所有的资产.<br/>
* @param packAst packAst * @param packAst packAst
* @return int * @return int
......
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary; import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule; import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.abssqr.plat.common.facade.enums.AstTypeEnum; import com.abssqr.plat.common.facade.enums.AstTypeEnum;
import com.general.system.common.model.Money;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -63,11 +64,12 @@ public interface LoanPackRelDOMapper{ ...@@ -63,11 +64,12 @@ public interface LoanPackRelDOMapper{
LoanPackRelSummary sumAstByPack(@Param("packNo")String packNo); LoanPackRelSummary sumAstByPack(@Param("packNo")String packNo);
/** /**
* desc:筛选.<br/> * desc:筛选.<br/>
* @param avalAmt avalAmt
* @param packNo packNo * @param packNo packNo
* @param astPoolNo astPoolNo * @param astPoolNo astPoolNo
* @param astType astType * @param astType astType
* @param screenRuleList screenRuleList * @param screenRuleList screenRuleList
* @return int * @return int
*/ */
int updateForScreen(@Param("packNo")String packNo,@Param("astPoolNo")String astPoolNo,@Param("astType")AstTypeEnum astType,@Param("screenRuleList")List<AstScreenRule> screenRuleList); int updateForScreen(@Param("avalAmt")Money avalAmt,@Param("packNo")String packNo,@Param("astPoolNo")String astPoolNo,@Param("astType")AstTypeEnum astType,@Param("screenRuleList")List<AstScreenRule> screenRuleList);
} }
package com.abssqr.plat.common.dal.mysql.auto.paging;
import com.abssqr.plat.common.dal.mysql.auto.paging.BasePage;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoan;
import java.util.List;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.abssqr.plat.common.facade.enums.AstTypeEnum;
/**
* The table ABS_LOAN 信贷资产
*/
public class AstPackLoanPage extends BasePage<AstPoolLoan>{
/**
* screenRuleList .
*/
private List<AstScreenRule> screenRuleList;
/**
* astType .
*/
private AstTypeEnum astType;
/**
* astPoolNo .
*/
private String astPoolNo;
/**
* Set screenRuleList .
*/
public void setScreenRuleList(List<AstScreenRule> screenRuleList){
this.screenRuleList = screenRuleList;
}
/**
* Get screenRuleList .
*
* @return the string
*/
public List<AstScreenRule> getScreenRuleList(){
return screenRuleList;
}
/**
* Set astType .
*/
public void setAstType(AstTypeEnum astType){
this.astType = astType;
}
/**
* Get astType .
*
* @return the string
*/
public AstTypeEnum getAstType(){
return astType;
}
/**
* Set astPoolNo .
*/
public void setAstPoolNo(String astPoolNo){
this.astPoolNo = astPoolNo;
}
/**
* Get astPoolNo .
*
* @return the string
*/
public String getAstPoolNo(){
return astPoolNo;
}
}
...@@ -557,6 +557,66 @@ ...@@ -557,6 +557,66 @@
where table_alias.rowno &gt; #{startRow} where table_alias.rowno &gt; #{startRow}
</select> </select>
<!--根据资产池编号查询对应的资产 pageCount mydalgen自动生成,请勿修改-->
<select id="getLoanListForPackAddAstCount" resultType="int" >
SELECT
COUNT(*) AS total
FROM
ABS_LOAN L1
UNION (
<if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK">
<include refid="ABS_LOAN_PACK_REL.QCDK_SQL"/>
</if>
) u ON L1.ast_no=u.ast_no
LEFT JOIN ABS_LOAN_CONTRACT R1 ON L1.AST_NO=R1.AST_NO
LEFT JOIN ABS_LOAN_PACK_REL R2 ON L1.AST_NO=R2.AST_NO
LEFT JOIN ABS_AST_PACK R3 ON R2.PACK_NO=R3.PACK_NO
LEFT JOIN ABS_PLAN R4 ON R3.PLAN_NO=R4.PLAN_NO
WHERE
R2.STATUS='in'
AND R3.AST_POOL_NO=#{astPoolNo,jdbcType=VARCHAR}
</select>
<!--根据资产池编号查询对应的资产 pageResult mydalgen自动生成,请勿修改-->
<select id="getLoanListForPackAddAstResult" resultMap="AstPoolLoan" >
select
*
from(
select
tt.*,ROWNUM AS rowno
from(
SELECT
L1.AST_NO, --资产编号
L1.PRIN_BAL, --贷款剩余本金
L1.START_DATE, --贷款日期
L1.TERM_CNT-L1.CUR_TERM AS FREE_TERM, --贷款剩余期限
R1.RATE, --贷款利率
L1.RISK_CL, --五级分类
R1.REPAY_PERIOD, --还款周期
R1.REPAY_PERIOD_TYPE, --还款周期类型
R1.REPAY_METHOD, --还款方式
R4.PLAN_NAME --资产归属
FROM
ABS_LOAN L1
UNION (
<if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK">
<include refid="com.abssqr.plat.common.dal.mysql.auto.mapper.LoanPackRelDOMapper.QCDK_SQL"/>
</if>
) u ON L1.ast_no=u.ast_no
LEFT JOIN ABS_LOAN_CONTRACT R1 ON L1.AST_NO=R1.AST_NO
LEFT JOIN ABS_LOAN_PACK_REL R2 ON L1.AST_NO=R2.AST_NO
LEFT JOIN ABS_AST_PACK R3 ON R2.PACK_NO=R3.PACK_NO
LEFT JOIN ABS_PLAN R4 ON R3.PLAN_NO=R4.PLAN_NO
WHERE
R2.STATUS='in'
AND R3.AST_POOL_NO=#{astPoolNo,jdbcType=VARCHAR}
) tt where ROWNUM &lt;= #{endRow}
) table_alias
where table_alias.rowno &gt; #{startRow}
</select>
<!--根据资产包编号分页获取所有的资产 pageCount mydalgen自动生成,请勿修改--> <!--根据资产包编号分页获取所有的资产 pageCount mydalgen自动生成,请勿修改-->
<select id="getLoanPageByPackNoCount" resultType="int" > <select id="getLoanPageByPackNoCount" resultType="int" >
SELECT SELECT
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
,STATUS,GMT_CREATE,GMT_MODIFIED,REPAY_FINAL_DATE,BACK_RATE ,STATUS,GMT_CREATE,GMT_MODIFIED,REPAY_FINAL_DATE,BACK_RATE
</sql> </sql>
<sql id="QCDK_SQL"> <sql id="QCDK_SQL">
SELECT l.ast_no SELECT l.ast_no,sum(l.prin_bal)OVER(order by l.ast_no desc) sum_bal
FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc FROM abs_loan_pack_rel rel,abs_loan l,ABS_LOAN_CONTRACT lc
WHERE WHERE
l.ast_no = rel.ast_no l.ast_no = rel.ast_no
...@@ -37,28 +37,57 @@ ...@@ -37,28 +37,57 @@
AND rel.status = 'in' AND rel.status = 'in'
AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR} AND rel.PACK_NO = #{astPoolNo,jdbcType=VARCHAR}
<foreach collection="screenRuleList" item="rule"> <foreach collection="screenRuleList" item="rule">
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RISK_TYPE"> <choose>
<!-- 五级分类 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RISK_TYPE">
AND l.RISK_CL in AND l.RISK_CL in
<foreach collection="rule.listVal" item="val" open="(" separator="," close=")"> <foreach collection="rule.listVal" item="val" open="(" separator="," close=")">
#{val,jdbcType=VARCHAR} #{val,jdbcType=VARCHAR}
</foreach> </foreach>
</if> </when>
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_DISB_DATE"> <!-- 贷款发放日 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_DISB_DATE">
<if test="rule.leftCondition != null"> <if test="rule.leftCondition != null">
AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
<if test="rule.rightCondition != null"> <if test="rule.rightCondition != null">
AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
</if> </when>
<if test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_END_DATE"> <!-- 贷款到期日 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_END_DATE">
<if test="rule.leftCondition != null"> <if test="rule.leftCondition != null">
AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.leftCondition.code} to_date(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
<if test="rule.rightCondition != null"> <if test="rule.rightCondition != null">
AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd') AND lc.DISB_DATE ${rule.rightCondition.code} to_date(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if> </if>
</when>
<!-- 执行利率 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_LOAN_RATE">
<if test="rule.leftCondition != null">
AND lc.RATE ${rule.leftCondition.code} to_number(#{rule.leftValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if>
<if test="rule.rightCondition != null">
AND lc.RATE ${rule.rightCondition.code} to_number(#{rule.rightValue,jdbcType=VARCHAR},'yyyy-MM-dd')
</if>
</when>
<!-- 还款频率 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_REPAY_FREQ">
<if test="rule.rightCondition != null">
AND lc.REPAY_PERIOD ${rule.rightCondition.code} #{rule.rightValue,jdbcType=VARCHAR}
</if>
</when>
<!-- 利率类型 -->
<when test="rule.ruleType == @com.abssqr.plat.common.facade.enums.AstScreenRuleTypeEnum@QCDK_RATE_TYPE">
<if test="rule.rightCondition != null">
AND lc.RATE_TYPE ${rule.rightCondition.code} #{rule.rightValue,jdbcType=VARCHAR}
</if> </if>
</when>
<otherwise>
@failure
</otherwise>
</choose>
</foreach> </foreach>
</sql> </sql>
...@@ -190,9 +219,14 @@ ...@@ -190,9 +219,14 @@
where where
PACK_NO = #{astPoolNo,jdbcType=VARCHAR} PACK_NO = #{astPoolNo,jdbcType=VARCHAR}
AND ast_no in( AND ast_no in(
select
ast_no
from(
<if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK"> <if test="astType == @com.abssqr.plat.common.facade.enums.AstTypeEnum@QCDK">
<include refid="QCDK_SQL"/> <include refid="QCDK_SQL"/>
</if> </if>
)where
sum_bal &lt;= ${avalAmt,jdbcType=DECIMAL}
) )
</update> </update>
</mapper> </mapper>
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
<result column="PLAN_NO" property="planNo" jdbcType="VARCHAR" javaType="String"/> <result column="PLAN_NO" property="planNo" jdbcType="VARCHAR" javaType="String"/>
<result column="FEE_NAME" property="feeName" jdbcType="VARCHAR" javaType="String"/> <result column="FEE_NAME" property="feeName" jdbcType="VARCHAR" javaType="String"/>
<result column="FEE_CALC_TYPE" property="feeCalcType" jdbcType="VARCHAR" javaType="String"/> <result column="FEE_CALC_TYPE" property="feeCalcType" jdbcType="VARCHAR" javaType="String"/>
<result column="FEE_TIME_TYPE" property="feeTimeType" jdbcType="VARCHAR" javaType="String"/>
<result column="FEE_SCALE_TYPE" property="feeScaleType" jdbcType="VARCHAR" javaType="String"/> <result column="FEE_SCALE_TYPE" property="feeScaleType" jdbcType="VARCHAR" javaType="String"/>
<result column="GMT_CREATE" property="gmtCreate" jdbcType="DATE" javaType="java.util.Date"/> <result column="GMT_CREATE" property="gmtCreate" jdbcType="DATE" javaType="java.util.Date"/>
<result column="GMT_MODIFIED" property="gmtModified" jdbcType="DATE" javaType="java.util.Date"/> <result column="GMT_MODIFIED" property="gmtModified" jdbcType="DATE" javaType="java.util.Date"/>
<result column="FEE_CALC_DEFAULT_DATE" property="feeCalcDefaultDate" jdbcType="DATE" javaType="java.util.Date"/>
<result column="FEE_RATE" property="feeRate" jdbcType="DECIMAL" javaType="java.math.BigDecimal"/> <result column="FEE_RATE" property="feeRate" jdbcType="DECIMAL" javaType="java.math.BigDecimal"/>
</resultMap> </resultMap>
......
...@@ -10,6 +10,8 @@ import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary; ...@@ -10,6 +10,8 @@ import com.abssqr.plat.common.dal.mysql.auto.resultmap.LoanPackRelSummary;
import com.abssqr.plat.common.facade.enums.AstTypeEnum; import com.abssqr.plat.common.facade.enums.AstTypeEnum;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule; import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.general.system.common.model.Money;
/** /**
* *
* @author bangis.wangdf * @author bangis.wangdf
...@@ -35,7 +37,8 @@ public interface LoanPackRelRepo { ...@@ -35,7 +37,8 @@ public interface LoanPackRelRepo {
* @param astPoolNo * @param astPoolNo
* @param astType * @param astType
* @param screenRuleList * @param screenRuleList
* @param avalAmt
* @return * @return
*/ */
int screenAst(String packNo, String astPoolNo, AstTypeEnum astType, List<AstScreenRule> screenRuleList); int screenAst(String packNo, String astPoolNo, AstTypeEnum astType, List<AstScreenRule> screenRuleList, Money avalAmt);
} }
...@@ -12,6 +12,7 @@ import com.abssqr.plat.common.facade.enums.AstTypeEnum; ...@@ -12,6 +12,7 @@ import com.abssqr.plat.common.facade.enums.AstTypeEnum;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule; import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.abssqr.plat.common.model.repo.ast.LoanPackRelRepo; import com.abssqr.plat.common.model.repo.ast.LoanPackRelRepo;
import com.general.system.common.model.Money;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -53,7 +54,7 @@ public class LoanPackRelImpl implements LoanPackRelRepo { ...@@ -53,7 +54,7 @@ public class LoanPackRelImpl implements LoanPackRelRepo {
* @return * @return
*/ */
@Override @Override
public int screenAst(String packNo, String astPoolNo, AstTypeEnum astType, List<AstScreenRule> screenRuleList) { public int screenAst(String packNo, String astPoolNo, AstTypeEnum astType, List<AstScreenRule> screenRuleList, Money avalAmt) {
return loanPackRelDAO.updateForScreen(packNo,astPoolNo,astType,screenRuleList); return loanPackRelDAO.updateForScreen(avalAmt,packNo,astPoolNo,astType,screenRuleList);
} }
} }
...@@ -25,6 +25,6 @@ public class AstScreenRuleComponent { ...@@ -25,6 +25,6 @@ public class AstScreenRuleComponent {
* @return * @return
*/ */
public int screenAst(AstPack astPack) { public int screenAst(AstPack astPack) {
return loanPackRelRepo.screenAst(astPack.getPackNo(),astPack.getAstPoolNo(),astPack.getAstType(),astPack.getScreenRuleList()); return loanPackRelRepo.screenAst(astPack.getPackNo(),astPack.getAstPoolNo(),astPack.getAstType(),astPack.getScreenRuleList(),astPack.getAvalAmt());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment