Commit f25410e9 by Water Wang

optimize -- policy info query

parent d69f8030
package com.yd.api.practitioner.vo.policy.policyinfoquery;
public class PolicyFactorInfo {
private String productId;
private String productCode;
private String productName;
private String insurerId;
private String insurerName;
private Double premium;
private Double commission;
private Double commissionRate;
private String policyType;
private String payFrequency;
private String payCommissionStatus;
private String commissionType;
private String insuredAmount;
private String relationship;
private String amountUnit;
private Integer period;
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getInsurerId() {
return insurerId;
}
public void setInsurerId(String insurerId) {
this.insurerId = insurerId;
}
public String getInsurerName() {
return insurerName;
}
public void setInsurerName(String insurerName) {
this.insurerName = insurerName;
}
public Double getPremium() {
return premium;
}
public void setPremium(Double premium) {
this.premium = premium;
}
public Double getCommission() {
return commission;
}
public void setCommission(Double commission) {
this.commission = commission;
}
public Double getCommissionRate() {
return commissionRate;
}
public void setCommissionRate(Double commissionRate) {
this.commissionRate = commissionRate;
}
public String getPolicyType() {
return policyType;
}
public void setPolicyType(String policyType) {
this.policyType = policyType;
}
public String getPayFrequency() {
return payFrequency;
}
public void setPayFrequency(String payFrequency) {
this.payFrequency = payFrequency;
}
public String getPayCommissionStatus() {
return payCommissionStatus;
}
public void setPayCommissionStatus(String payCommissionStatus) {
this.payCommissionStatus = payCommissionStatus;
}
public String getCommissionType() {
return commissionType;
}
public void setCommissionType(String commissionType) {
this.commissionType = commissionType;
}
public String getInsuredAmount() {
return insuredAmount;
}
public void setInsuredAmount(String insuredAmount) {
this.insuredAmount = insuredAmount;
}
public String getRelationship() {
return relationship;
}
public void setRelationship(String relationship) {
this.relationship = relationship;
}
public String getAmountUnit() {
return amountUnit;
}
public void setAmountUnit(String amountUnit) {
this.amountUnit = amountUnit;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
}
......@@ -23,6 +23,7 @@ public class PolicyInfoQueryResponseVO {
private HolderInfo holderInfo;//投保人
private List<InsuredInfo> insuredInfos;//被保险人对象列表
private RenewBankInfo renewBankInfo;//续保银行卡信息
private List<PolicyFactorInfo> policyFactorInfos;//寿险投保因子相关信息
private CommonResult commonResult;
public Long getOrderId() {
......@@ -151,6 +152,14 @@ public class PolicyInfoQueryResponseVO {
this.renewBankInfo = renewBankInfo;
}
public List<PolicyFactorInfo> getPolicyFactorInfos() {
return policyFactorInfos;
}
public void setPolicyFactorInfos(List<PolicyFactorInfo> policyFactorInfos) {
this.policyFactorInfos = policyFactorInfos;
}
public CommonResult getCommonResult() { return commonResult; }
public void setCommonResult(CommonResult commonResult) { this.commonResult = commonResult; }
......
......@@ -24,9 +24,9 @@ public class PolicyDetailInfoE {
private String productName;
private String insurerId;
private String insurerName;
private String premium;
private String commission;
private String commissionRate;
private Double premium;
private Double commission;
private Double commissionRate;
private String policyType;
private String payFrequency;
private String payCommissionStatus;
......@@ -216,27 +216,27 @@ public class PolicyDetailInfoE {
this.insurerName = insurerName;
}
public String getPremium() {
public Double getPremium() {
return premium;
}
public void setPremium(String premium) {
public void setPremium(Double premium) {
this.premium = premium;
}
public String getCommission() {
public Double getCommission() {
return commission;
}
public void setCommission(String commission) {
public void setCommission(Double commission) {
this.commission = commission;
}
public String getCommissionRate() {
public Double getCommissionRate() {
return commissionRate;
}
public void setCommissionRate(String commissionRate) {
public void setCommissionRate(Double commissionRate) {
this.commissionRate = commissionRate;
}
......
package com.yd.dal.entity.order;
public class PolicyFactorInfoE {
private String orderNo;
private String productId;
private String insuredAmount;
private String relationship;
private String amountUnit;
private Integer period;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getInsuredAmount() {
return insuredAmount;
}
public void setInsuredAmount(String insuredAmount) {
this.insuredAmount = insuredAmount;
}
public String getRelationship() {
return relationship;
}
public void setRelationship(String relationship) {
this.relationship = relationship;
}
public String getAmountUnit() {
return amountUnit;
}
public void setAmountUnit(String amountUnit) {
this.amountUnit = amountUnit;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
}
package com.yd.dal.mapper.meta;
import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.meta.OptionsEGolden;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -28,4 +29,6 @@ public interface MdDropOptionsMapper {
MdDropOptions selectByMasterCodeAndOptionsCode(@Param("masterCode") String masterCode, @Param("optionsCode") String optionsCode);
List<MdDropOptions> findByMasterCodeAndOptionsCode(@Param("masterCode")String masterCode, @Param("optionsCode")String optionsCode);
List<OptionsEGolden> findByMasterIdsE(@Param("materIds")List<Integer> materIds);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.yd.dal.mapper.order;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.order.PolicyDetailInfoE;
import com.yd.dal.entity.order.PolicyFactorInfoE;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -29,4 +30,6 @@ public interface PoOrderMapper {
String findOrderNoByPolicyNo(@Param("policyNo")String policyNo);
List<PolicyDetailInfoE> findPolicyDetailsInfoByOrderNoE(@Param("orderNo")String orderNo);
List<PolicyFactorInfoE> findPolicyFactorByOrderNosE(@Param("orderNoList")List<String> orderNoList);
}
\ No newline at end of file
package com.yd.dal.service.meta;
import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.meta.OptionsEGolden;
import java.util.List;
public interface MdDropOptionsDALService {
......@@ -18,4 +19,6 @@ public interface MdDropOptionsDALService {
MdDropOptions selectByMasterCodeAndOptionsCode(String masterCode, String optionsCode);
List<MdDropOptions> findByMasterCodeAndOptionsCode(String team_building_track, String s);
List<OptionsEGolden> findByMasterIdsE(List<Integer> materIds);
}
package com.yd.dal.service.meta.impl;
import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.entity.meta.OptionsEGolden;
import com.yd.dal.mapper.meta.MdDropOptionsMapper;
import com.yd.dal.service.meta.MdDropOptionsDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
......@@ -52,4 +55,10 @@ public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService {
public List<MdDropOptions> findByMasterCodeAndOptionsCode(String masterCode, String optionsCode) {
return mdDropOptionsMapper.findByMasterCodeAndOptionsCode(masterCode,optionsCode);
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<OptionsEGolden> findByMasterIdsE(List<Integer> materIds) {
return mdDropOptionsMapper.findByMasterIdsE(materIds);
}
}
......@@ -3,6 +3,7 @@ package com.yd.dal.service.order.Impl;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.order.PolicyDetailInfoE;
import com.yd.dal.entity.order.PolicyFactorInfoE;
import com.yd.dal.mapper.order.PoOrderMapper;
import com.yd.dal.service.order.PoOrderDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
......@@ -49,4 +50,10 @@ public class PoOrderDALServiceImpl implements PoOrderDALService {
public List<PolicyDetailInfoE> findPolicyDetailsInfoByOrderNoE(String orderNo) {
return poOrderMapper.findPolicyDetailsInfoByOrderNoE(orderNo);
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<PolicyFactorInfoE> findPolicyFactorByOrderNosE(List<String> orderNoList) {
return poOrderMapper.findPolicyFactorByOrderNosE(orderNoList);
}
}
......@@ -3,6 +3,7 @@ package com.yd.dal.service.order;
import com.yd.dal.entity.order.CustomerPolicyInfo;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.order.PolicyDetailInfoE;
import com.yd.dal.entity.order.PolicyFactorInfoE;
import java.util.List;
......@@ -18,4 +19,6 @@ public interface PoOrderDALService {
String findOrderNoByPolicyNo(String policyNo);
List<PolicyDetailInfoE> findPolicyDetailsInfoByOrderNoE(String orderNo);
List<PolicyFactorInfoE> findPolicyFactorByOrderNosE(List<String> orderNoList);
}
......@@ -18,9 +18,9 @@ multiple.datasource.master.password=devdbpass1
#egolden
multiple.datasource.egolden.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.egolden.url=jdbc:MySql://139.224.94.140:13307/ydinsurance?characterEncoding=UTF-8&useSSL=false&useAffectedRows=true
multiple.datasource.egolden.username=stageuser
multiple.datasource.egolden.password=AG@#$mstage234
multiple.datasource.egolden.url=jdbc:MySql://139.224.138.103:13308/stage_ydinsurance?characterEncoding=UTF-8&useSSL=false&useAffectedRows=true
multiple.datasource.egolden.username=insurance_stage
multiple.datasource.egolden.password=fWTauSswR2!$
#pagehelper分页插件配置
pagehelper.helperDialect=mysql
......
......@@ -18,9 +18,9 @@ multiple.datasource.master.password=devdbpass1
#egolden
multiple.datasource.egolden.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.egolden.url=jdbc:MySql://139.224.94.140:13307/ydinsurance?characterEncoding=UTF-8&useSSL=false&useAffectedRows=true
multiple.datasource.egolden.username=stageuser
multiple.datasource.egolden.password=AG@#$mstage234
multiple.datasource.egolden.url=jdbc:MySql://139.224.138.103:13308/stage_ydinsurance?characterEncoding=UTF-8&useSSL=false&useAffectedRows=true
multiple.datasource.egolden.username=insurance_stage
multiple.datasource.egolden.password=fWTauSswR2!$
#pagehelper分页插件配置
pagehelper.helperDialect=mysql
......
......@@ -242,4 +242,16 @@
from ag_md_drop_master m left join ag_md_drop_options o on m.id = o.drop_master_id and o.is_active = 1 and o.drop_option_code = #{optionsCode,jdbcType=VARCHAR}
where m.scenario_code = #{masterCode,jdbcType=BIGINT}
</select>
<select id="findByMasterIdsE" resultType="com.yd.dal.entity.meta.OptionsEGolden">
select
t.DRP_OPT_ID as optId,
t.FK_DRP_MST_ID as mstId,
t.DRP_OPT_NAME as optName,
t.DRP_OPT_ATTR as optAttr,
t.DRP_OPT_ORDER as optOrder
from drp002 t where t.FK_DRP_MST_ID in
<foreach collection="materIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -1000,15 +1000,17 @@
<when test="time == 3">
and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
</when>
<otherwise>
<when test="time == 2">
and YEAR(f.order_date) = YEAR(now())
</when>
<otherwise>
</otherwise>
</choose>
</select>
<select id="findPolicyInfoByMobileNoE" resultType="com.yd.dal.entity.order.CustomerPolicyInfo">
SELECT
policy.INS_MST_ID as orderNo ,
policy.INS_MST_POLICY_NUM as policyyNo ,
policy.INS_MST_POLICY_NUM as policyNo ,
c.CUS_MST_NAME as holderName,
date_format(policy.INS_MST_ACCEPT_DATE, '%Y-%m-%d %H:%i:%s') as orderDate,
date_format(policy.INS_MST_EFFECT_DATE, '%Y-%m-%d %H:%i:%s') as startDate,
......@@ -1016,7 +1018,7 @@
sum(m.MON025_405) as referralAmount,
sum(m.MON025_401) as orderPrice,
m.MON025_004 as productName
FROM sal001 p INNER JOIN MON025 m on m.MON025_007 = p.SAL_MST_ID and m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'-- 业务员id
FROM sal001 p INNER JOIN MON025 m on m.MON025_007 = p.SAL_MST_ID AND m.MON025_303 = 1
inner JOIN ins001 policy on m.MON025_002 = policy.INS_MST_ID -- 保单id
inner join cus001 c on policy.FK_CUS_PRO_ID = c.CUS_MST_ID
WHERE p.SAL_MST_MOBILE like concat(concat('%',#{mobileNo,jdbcType=VARCHAR}),'%')
......@@ -1027,8 +1029,10 @@
<when test="time == 3">
and QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
<when test="time == 3">
and YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</when>
<otherwise>
</otherwise>
</choose>
group by policy.ins_mst_id
......@@ -1056,13 +1060,13 @@
holder.CUS_MST_ID as holderId, -- 投保人编码
holder.CUS_MST_ID_NUM as holderIdNo, -- 投保人编码
holder.CUS_MST_SEX as holderSex, -- 投保人性别
holder.CUS_MST_BIRTHDAY as holderBirthday, -- 投保人出生年月
date_format(holder.CUS_MST_BIRTHDAY, '%Y-%m-%d') as holderBirthday, -- 投保人出生年月
holder.CUS_MST_CELL_NUM as holderMobileNo, -- 投保人手机号码
insured.CUS_MST_NAME as insuredName, -- 被保人姓名
insured.CUS_MST_ID as insuredId, -- 被保人编码
insured.CUS_MST_ID_NUM as insuredIdNo, -- 被保人编码
insured.CUS_MST_SEX as insuredSex, -- 被保人性别
insured.CUS_MST_BIRTHDAY as insuredBirthday, -- 被保人出生年月
date_format(insured.CUS_MST_BIRTHDAY, '%Y-%m-%d') as insuredBirthday, -- 被保人出生年月
insured.CUS_MST_CELL_NUM as insuredMobileNo, -- 被保人手机号码
m.MON025_405 as commission, -- 佣金
m.MON025_404 as commissionRate, -- 佣金率
......@@ -1070,12 +1074,25 @@
m.MON025_401 as premium, -- 保费
m.MON025_101 as policyType, -- 保单类型
m.MON025_102 as payFrequency, -- 缴费频率
m.MON025_109 as payCommissionStatus -- 发佣状态
FROM ins001 policy INNER JOIN MON025 m on m.MON025_002 = policy.INS_MST_ID and m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'-- 业务员id
m.MON025_109 as payCommissionStatus, -- 发佣状态
m.mon025_108 as commissionType -- 佣金项目代码
FROM ins001 policy INNER JOIN MON025 m on m.MON025_002 = policy.INS_MST_ID AND m.MON025_303 = 1
inner join cus001 holder on policy.FK_CUS_PRO_ID = holder.CUS_MST_ID
inner join cus001 insured on policy.FK_CUS_PRO_ID = insured.CUS_MST_ID
inner join prd001 product on m.MON025_004 = product.PRD_MST_ID
inner join prd004 insurer on product.FK_PRD_SUP_ID = insurer.PRD_SUP_ID
WHERE policy.INS_MST_ID = #{orderNo,jdbcType=VARCHAR};
</select>
<select id="findPolicyFactorByOrderNosE" resultType="com.yd.dal.entity.order.PolicyFactorInfoE">
SELECT policy2.FK_INS_MST_ID as orderNo, -- 保单id
policy2.FK_PRD_MST_ID as productId, -- 产品ID
policy2.INS_IND_RELATIONSHIP as relationship,-- 与被保人关系
policy2.INS_IND_INSURED_AMOUNT as insuredAmount, -- 保费
policy2.INS_IND_AMOUNT_UNIT as amountUnit, -- 保费单位
policy2.INS_IND_PERIOD as period -- 缴费年限
from ins002 policy2 where policy2.FK_INS_MST_ID in
<foreach collection="orderNoList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
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