Commit 662b958a by zhangxingmin

push

parent ad2aeaef
...@@ -2,12 +2,20 @@ package com.yd.product.feign.request.announcementcommissionratio; ...@@ -2,12 +2,20 @@ package com.yd.product.feign.request.announcementcommissionratio;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
public class ApiAnnouncementCommissionRatioListRequest { public class ApiAnnouncementCommissionRatioListRequest {
/** /**
* 产品上架信息表唯一业务ID
*/
private String productLaunchBizId;
//列出固定几个需要参与发佣率筛选数据的保单字段
/**
* 生效日期 * 生效日期
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
...@@ -18,8 +26,33 @@ public class ApiAnnouncementCommissionRatioListRequest { ...@@ -18,8 +26,33 @@ public class ApiAnnouncementCommissionRatioListRequest {
*/ */
private String paymentTerm; private String paymentTerm;
// /**
// * 供款年期(数字)
// */
// private Integer issueNumber;
/** /**
* 产品上架信息表唯一业务ID * 投保年龄(区间值)
*/ */
private String productLaunchBizId; private String age;
/**
* 期缴保费(区间值)
*/
private BigDecimal eachIssuePremium;
/**
* 专业投资者(Yes/No)(选项)
*/
private String professionalInvestor;
/**
* 保单币种(选项)
*/
private String policyCurrency;
/**
* 保障年期(数字)
*/
private String guaranteePeriod;
} }
...@@ -14,7 +14,100 @@ ...@@ -14,7 +14,100 @@
</where> </where>
</select> </select>
<select id="conditionList" resultType="com.yd.product.feign.response.announcementcommissionratio.ApiAnnouncementCommissionRatioListResponse"> <select id="conditionList"
resultType="com.yd.product.feign.response.announcementcommissionratio.ApiAnnouncementCommissionRatioListResponse">
WITH valid_species AS (
SELECT *
FROM announcement_species
WHERE is_deleted = 0
AND status = 1
<if test="request.productLaunchBizId != null and request.productLaunchBizId != ''">
AND product_launch_biz_id = #{request.productLaunchBizId}
</if>
<if test="request.paymentTerm != null and request.paymentTerm != ''">
AND payment_term = #{request.paymentTerm}
</if>
AND species_json IS NOT NULL
AND JSON_VALID(species_json) = 1
AND JSON_TYPE(species_json) = 'ARRAY'
),
species_attrs AS (
SELECT
as1.announcement_species_biz_id,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'PAYMENT_TERM', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS payment_term_val,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'AGE', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS age_val,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'PREMIUM', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS premium_val,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'PROFESSIONAL', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS professional_val,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'POLICY_CURRENCY', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS policy_currency_val,
JSON_UNQUOTE(
JSON_EXTRACT(
as1.species_json,
CONCAT(
REPLACE(
JSON_UNQUOTE(JSON_SEARCH(as1.species_json, 'one', 'GUARANTEE_PERIOD', NULL, '$[*].typeCode')),
'.typeCode',
'.value'
)
)
)
) AS guarantee_period_val
FROM valid_species as1
)
SELECT SELECT
as1.product_launch_biz_id, as1.product_launch_biz_id,
as1.payment_term, as1.payment_term,
...@@ -31,23 +124,77 @@ ...@@ -31,23 +124,77 @@
acr.is_exchange_rate, acr.is_exchange_rate,
acr.currency acr.currency
FROM announcement_commission_ratio acr FROM announcement_commission_ratio acr
INNER JOIN announcement_species as1 INNER JOIN species_attrs sa ON acr.announcement_species_biz_id = sa.announcement_species_biz_id
ON acr.announcement_species_biz_id = as1.announcement_species_biz_id INNER JOIN valid_species as1 ON acr.announcement_species_biz_id = as1.announcement_species_biz_id
<where> WHERE acr.is_deleted = 0
as1.is_deleted = 0
AND as1.status = 1
AND acr.is_deleted = 0
AND acr.status = 1 AND acr.status = 1
<if test="request.productLaunchBizId != null and request.productLaunchBizId != ''"> <if test="request.effectiveDate != null">
AND as1.product_launch_biz_id = #{request.productLaunchBizId} AND DATE(#{request.effectiveDate}) BETWEEN DATE(acr.effective_start) AND DATE(acr.effective_end)
</if> </if>
<!-- 供款年期(数字)匹配 -->
<if test="request.paymentTerm != null and request.paymentTerm != ''"> <if test="request.paymentTerm != null and request.paymentTerm != ''">
AND as1.payment_term = #{request.paymentTerm} AND (
sa.payment_term_val = #{request.paymentTerm}
OR (
LOCATE('-', sa.payment_term_val) > 0
AND CAST(SUBSTRING_INDEX(sa.payment_term_val, '-', 1) AS UNSIGNED) &lt;= #{request.paymentTerm}
AND (
CAST(SUBSTRING_INDEX(sa.payment_term_val, '-', -1) AS UNSIGNED) >= #{request.paymentTerm}
OR SUBSTRING_INDEX(sa.payment_term_val, '-', -1) = ''
)
)
)
</if> </if>
<if test="request.effectiveDate != null"> <!-- 投保年龄(区间值)匹配 -->
AND DATE(#{request.effectiveDate}) BETWEEN DATE(acr.effective_start) AND DATE(acr.effective_end) <if test="request.age != null and request.age != ''">
AND (
sa.age_val = #{request.age}
OR (
LOCATE('-', sa.age_val) > 0
AND CAST(SUBSTRING_INDEX(sa.age_val, '-', 1) AS UNSIGNED) &lt;= CAST(#{request.age} AS UNSIGNED)
AND (
CAST(SUBSTRING_INDEX(sa.age_val, '-', -1) AS UNSIGNED) >= CAST(#{request.age} AS UNSIGNED)
OR SUBSTRING_INDEX(sa.age_val, '-', -1) = ''
)
)
)
</if>
<!-- 期缴保费(区间值)匹配 -->
<if test="request.eachIssuePremium != null">
AND (
sa.premium_val = #{request.eachIssuePremium}
OR (
LOCATE('-', sa.premium_val) > 0
AND CAST(SUBSTRING_INDEX(sa.premium_val, '-', 1) AS DECIMAL(20,2)) &lt;= #{request.eachIssuePremium}
AND (
CAST(SUBSTRING_INDEX(sa.premium_val, '-', -1) AS DECIMAL(20,2)) >= #{request.eachIssuePremium}
OR SUBSTRING_INDEX(sa.premium_val, '-', -1) = ''
)
)
)
</if>
<!-- 专业投资者(选项)匹配 -->
<if test="request.professionalInvestor != null and request.professionalInvestor != ''">
AND sa.professional_val = #{request.professionalInvestor}
</if>
<!-- 保单币种(选项)匹配 -->
<if test="request.policyCurrency != null and request.policyCurrency != ''">
AND sa.policy_currency_val = #{request.policyCurrency}
</if>
<!-- 保障年期(数字)匹配 -->
<if test="request.guaranteePeriod != null and request.guaranteePeriod != ''">
AND (
sa.guarantee_period_val = #{request.guaranteePeriod}
OR (
LOCATE('-', sa.guarantee_period_val) > 0
AND CAST(SUBSTRING_INDEX(sa.guarantee_period_val, '-', 1) AS UNSIGNED) &lt;= CAST(#{request.guaranteePeriod} AS UNSIGNED)
AND (
CAST(SUBSTRING_INDEX(sa.guarantee_period_val, '-', -1) AS UNSIGNED) >= CAST(#{request.guaranteePeriod} AS UNSIGNED)
OR SUBSTRING_INDEX(sa.guarantee_period_val, '-', -1) = ''
)
)
)
</if> </if>
</where>
ORDER BY acr.effective_start DESC ORDER BY acr.effective_start DESC
</select> </select>
</mapper> </mapper>
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