Commit 5b5c26e1 by wenyang

查询经纪人寿险销售保单,以前是通过N22接口获取,现在通过本地获取

parent 9ddb7538
......@@ -134,8 +134,8 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
return responseVO;
}
String mobileNo = aclPractitionerDALService.findMobileNoByPractitionerId(practitionerId);
if (!Strings.isNullOrEmpty(mobileNo) && mobileNo.length() == 11) {
// String mobileNo = aclPractitionerDALService.findMobileNoByPractitionerId(practitionerId);
// if (!Strings.isNullOrEmpty(mobileNo) && mobileNo.length() == 11) {
List<PolicyInfo> policyInfoList = new ArrayList<>();
Integer time = requestVO.getTime();
if (Integer.valueOf("1").equals(platform)) {
......@@ -145,7 +145,8 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
//2、线下
// getPolicyListForEGolden(policyInfoList, mobileNo, time);
try {
getPolicyListFromN22(policyInfoList, mobileNo, time);
// getPolicyListFromN22(policyInfoList, mobileNo, time);
getPolicyListFrom(policyInfoList, practitionerId, time);
} catch (Exception e) {
e.printStackTrace();
responseVO.setCommonResult(new CommonResult(false, e.getMessage()));
......@@ -156,9 +157,9 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
responseVO.setPolicyInfoList(policyInfoList);
Collections.sort(policyInfoList);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
} else {
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("820001")));
}
// } else {
// responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("820001")));
// }
} else {
String[] params = {"practitionerId"};
responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("610001", params)));
......@@ -1972,31 +1973,49 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
Long customerId = practitioner.getCustomerId();
if(customerId != null){
List<CustomerPolicyInfo> policyInfos = poOrderDALService.findPolicyInfoByCustomerId(customerId,time);
if(!policyInfos.isEmpty()){
PolicyInfo policyInfo ;
Map<Long,String> planNameMap = new HashMap<>();
Map<Long,String> productNameMap = new HashMap<>();
List<ProductPlan> plans = productPlanDALService.findAll();
List<Product> products = productDALService.findAll();
products.forEach(i->productNameMap.put(i.getId(),i.getName()));
plans.forEach(i->planNameMap.put(i.getId(),i.getName()));
Long planId ;
for(CustomerPolicyInfo item : policyInfos){
planId = item.getPlanId();
policyInfo = new PolicyInfo();
BeanUtils.copyProperties(item,policyInfo);
if(planId != null){
policyInfo.setPlanName(planNameMap.get(planId));
policyInfo.setNoPlanProduct(false);
}else{
policyInfo.setProductName(productNameMap.get(item.getProductId()));
policyInfo.setNoPlanProduct(true);
}
policyInfo.setPlatform(1);
policyInfoList.add(policyInfo);
}
policyInfoConvert(policyInfoList, policyInfos);
}
}
}
/**
* 银盾保险寿险保单--查询经纪人寿险保单列表
* @param policyInfoList 保单列表
* @param practitionerId 经纪人id
* @param time 时间段
* @throws Exception
*/
private void getPolicyListFrom(List<PolicyInfo> policyInfoList, Long practitionerId, Integer time) throws Exception {
if(practitionerId != null ){
AclPractitioner practitioner = aclPractitionerDALService.findById(practitionerId);
Long customerId = practitioner.getCustomerId();
if(customerId != null){
List<CustomerPolicyInfo> policyInfos = poOrderDALService.findLifePolicyInfoByCustomerId(customerId,time);
policyInfoConvert(policyInfoList, policyInfos);
}
}
}
/**
* 把查询结果集转换为保单显示列表
* @param policyInfoList 保单返回列表
* @param policyInfos 查询结果集列表
*/
private void policyInfoConvert(List<PolicyInfo> policyInfoList, List<CustomerPolicyInfo> policyInfos) {
if(!policyInfos.isEmpty()){
PolicyInfo policyInfo;
for(CustomerPolicyInfo item : policyInfos){
policyInfo = new PolicyInfo();
BeanUtils.copyProperties(item,policyInfo);
if(!Strings.isNullOrEmpty(policyInfo.getPlanName())){
policyInfo.setNoPlanProduct(false);
}else{
policyInfo.setNoPlanProduct(true);
}
policyInfo.setPlatform(1);
policyInfoList.add(policyInfo);
}
}
}
}
......@@ -19,6 +19,8 @@ public interface PoOrderMapper {
List<CustomerPolicyInfo> findPolicyInfoByCustomerId(@Param("customerId") Long customerId, @Param("time") Integer time);
List<CustomerPolicyInfo> findLifePolicyInfoByCustomerId(@Param("customerId") Long customerId, @Param("time") Integer time);
List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(@Param("mobileNo") String mobileNo, @Param("time") Integer time);
String findOrderNoByPolicyNo(@Param("policyNo") String policyNo);
......
......@@ -34,6 +34,11 @@ public class PoOrderDALServiceImpl implements PoOrderDALService {
}
@Override
public List<CustomerPolicyInfo> findLifePolicyInfoByCustomerId(Long customerId, Integer time) {
return poOrderMapper.findLifePolicyInfoByCustomerId(customerId,time);
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(String mobileNo, Integer time) {
return poOrderMapper.findPolicyInfoByMobileNoE(mobileNo,time);
......
......@@ -13,6 +13,8 @@ public interface PoOrderDALService {
PoOrder findByOrderId(Long orderId);
List<CustomerPolicyInfo> findPolicyInfoByCustomerId(Long customerId, Integer time);
List<CustomerPolicyInfo> findLifePolicyInfoByCustomerId(Long customerId, Integer time);
List<CustomerPolicyInfo> findPolicyInfoByMobileNoE(String mobileNo, Integer time);
......
......@@ -1023,25 +1023,69 @@
f.order_price as orderPrice,
o.plan_id as planId,
o.product_id as productId ,
f.id as fortuneId
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id and o.status = 3 and o.order_price
&gt; 0 and o.insurer_id != 888
inner JOIN ag_acl_policyholder p ON o.id = p.order_id and p.type = 2
f.id as fortuneId,
pr.name as productName,
pl.name as planName
FROM ag_acl_customer_fortune f
INNER JOIN ag_po_order o ON f.order_id = o.id and o.status = 3 AND o.payment_status=3 and o.order_price &gt; 0 and o.insurer_id != 888
INNER JOIN ag_acl_policyholder p ON o.id = p.order_id and p.type = 2
LEFT JOIN ag_product pr ON pr.id = o.product_id
LEFT JOIN ag_product_plan pl ON pl.id = o.plan_id
WHERE f.drop_option_code = 'S01' AND f.customer_id = #{customerId,jdbcType=BIGINT}
<choose>
<when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
and DATE_FORMAT(o.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
and QUARTER(o.order_date) = QUARTER(NOW()) AND year(o.order_date)=year(now())
</when>
<when test="time == 2">
and YEAR(f.order_date) = YEAR(now())
and YEAR(o.order_date) = YEAR(now())
</when>
<otherwise>
</otherwise>
</choose>
</select>
<select id="findLifePolicyInfoByCustomerId" 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,
f.referral_amount as referralAmount,
f.order_price as orderPrice,
o.plan_id as planId,
o.product_id as productId ,
f.id as fortuneId,
pr.name as productName,
pl.name as planName
FROM ag_acl_customer_fortune f
INNER JOIN ag_po_order o ON f.order_id = o.id AND o.status = 3 AND o.payment_status=3 AND o.order_price &gt; 0 AND o.insurer_id != 888
INNER JOIN ag_acl_policyholder p ON o.id = p.order_id AND p.type = 2
INNER JOIN ag_acl_policyholder ph ON o.id = ph.order_id AND f.customer_id = ph.customer_id AND ph.type = 7
LEFT JOIN ag_product pr ON pr.id = o.product_id
LEFT JOIN ag_product_plan pl ON pl.id = o.plan_id
WHERE f.drop_option_code IN('S01','C01') AND o.product_category_id ='8' AND f.customer_id = #{customerId,jdbcType=BIGINT}
<choose>
<when test="time == 1">
and DATE_FORMAT(o.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(o.order_date) = QUARTER(NOW()) AND year(o.order_date)=year(now())
</when>
<when test="time == 2">
and YEAR(o.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 ,
......
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