Commit 5b5c26e1 by wenyang

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

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