Commit c5ba57fd by jianan

【ydlife】-【客户管理】-6车险保单查询

parent 75ec998a
......@@ -2105,7 +2105,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
if (CollectionUtils.isNotEmpty(orderIdList)) {
List<CustomerHolder> list = aclPolicyholderMapper.queryThisPractitiionerAllPolicyHolderList(orderIdList);
// 如果姓名,出生日期为空就去查ag_acl_policyholder表的记录
this.completeCustomerHolder(list);
this.completeCustomerHolder(list, 2);
resp.setList(list);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
......@@ -2122,7 +2122,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
if (customerId != null) {
List<CustomerHolder> list = aclPolicyholderMapper.queryInsuredListByHolderCustomerId(customerId);
// 如果姓名,出生日期为空就去查ag_acl_policyholder表的记录
this.completeCustomerHolder(list);
this.completeCustomerHolder(list, 3);
resp.setList(list);
resp.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
......@@ -2131,11 +2131,11 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return resp;
}
private void completeCustomerHolder(List<CustomerHolder> list) {
private void completeCustomerHolder(List<CustomerHolder> list, int holderType) {
CustomerHolder info;
for (CustomerHolder holder:list) {
if (holder.getName() == null || holder.getBirthDate() == null) {
info = aclPolicyholderMapper.queryUsefulInfo(holder.getCustomerId(), 2);
info = aclPolicyholderMapper.queryUsefulInfo(holder.getCustomerId(), holderType);
if (info != null) {
BeanUtils.copyProperties(info, holder);
}
......
......@@ -31,5 +31,5 @@ public interface AclPolicyholderMapper {
List<CustomerPolicyInfo> queryPolicyListByHolderCustomerId(QueryPolicyListByHolderCustomerIdRequestVO requestVO);
CustomerHolder queryUsefulInfo(@Param("customerId") Long customerId, @Param("type") int type);
CustomerHolder queryUsefulInfo(@Param("customerId") Long customerId, @Param("type") int holderType);
}
\ No newline at end of file
......@@ -973,22 +973,25 @@
left join ag_acl_customer c on t.customer_id = c.id
</select>
<sql id="customerPolicyInfoFields">
o.id as orderId,
o.order_no as orderNo ,
o.policy_no as policyNo ,
p.name as holderName,
o.destination as destination,
date_format(o.order_date, '%Y-%m-%d %H:%i:%s') as orderDate,
date_format(o.effective_start_date, '%Y-%m-%d %H:%i:%s') as startDate,
date_format(o.effective_end_date, '%Y-%m-%d %H:%i:%s') as endDate,
o.order_price as orderPrice,
o.plan_id as planId,
o.product_id as productId ,
IF(o.effective_start_date &lt;= NOW() and o.effective_end_date &gt;= NOW(),'有效','无效') isValid,
a.name planName,
b.name productName
</sql>
<select id="queryPolicyListByHolderCustomerId" resultType="com.yd.dal.entity.order.CustomerPolicyInfo">
SELECT
o.id as orderId,
o.order_no as orderNo ,
o.policy_no as policyNo ,
p.name as holderName,
o.destination as destination,
date_format(o.order_date, '%Y-%m-%d %H:%i:%s') as orderDate,
date_format(o.effective_start_date, '%Y-%m-%d %H:%i:%s') as startDate,
date_format(o.effective_end_date, '%Y-%m-%d %H:%i:%s') as endDate,
o.order_price as orderPrice,
o.plan_id as planId,
o.product_id as productId ,
IF(o.effective_start_date &lt;= NOW() and o.effective_end_date &gt;= NOW(),'有效','无效') isValid,
a.name planName,
b.name productName
<include refid="customerPolicyInfoFields"/>
FROM ag_po_order o
inner JOIN ag_acl_customer_fortune f
ON o.id = f.order_id and f.drop_option_code = 'S01' and o.status = 3 and o.order_price &gt; 0 and o.insurer_id != 888 and o.policy_no is not null
......@@ -998,6 +1001,22 @@
WHERE 1=1
and p.customer_id = #{holderCustomerId,jdbcType=BIGINT}
and f.customer_id = #{practitionerCustomerId,jdbcType=BIGINT}
UNION ALL
SELECT
<include refid="customerPolicyInfoFields"/>
FROM
(select o.*
from ag_po_quotation_vehicle_relation v
left join ag_po_order o on o.quotation_id = v.quotation_id
where v.customer_id = #{practitionerCustomerId,jdbcType=BIGINT}
) o
inner JOIN ag_acl_policyholder p ON o.id = p.order_id and p.type = 2
left join ag_product_plan a on o.plan_id = a.id
left join ag_product b on o.product_id = b.id
WHERE 1=1
and p.customer_id = #{holderCustomerId,jdbcType=BIGINT}
</select>
<select id="queryUsefulInfo" resultMap="customerHolder">
......
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