Commit ce85301a by jianan

N22保单列表查询接口和保单详情接口

parent b6a130c3
...@@ -105,15 +105,19 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -105,15 +105,19 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
public PolicyListQueryResponseVO policyListQuery(PolicyListQueryRequestVO requestVO) { public PolicyListQueryResponseVO policyListQuery(PolicyListQueryRequestVO requestVO) {
PolicyListQueryResponseVO responseVO = new PolicyListQueryResponseVO(); PolicyListQueryResponseVO responseVO = new PolicyListQueryResponseVO();
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
if(practitionerId !=null){ Integer platform = requestVO.getPlatform();
if (practitionerId != null) {
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)) {
//1、线上 //1、线上
getPolicyListForYD(policyInfoList,practitionerId,time); getPolicyListForYD(policyInfoList, practitionerId, time);
} else {
//2、线下 //2、线下
// getPolicyListForEGolden(policyInfoList,mobileNo,time); // getPolicyListForEGolden(policyInfoList, mobileNo, time);
try { try {
getPolicyListFromN22(policyInfoList, mobileNo, time); getPolicyListFromN22(policyInfoList, mobileNo, time);
} catch (Exception e) { } catch (Exception e) {
...@@ -121,14 +125,15 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -121,14 +125,15 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
responseVO.setCommonResult(new CommonResult(false, e.getMessage())); responseVO.setCommonResult(new CommonResult(false, e.getMessage()));
return responseVO; return responseVO;
} }
}
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)));
} }
...@@ -155,16 +160,17 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -155,16 +160,17 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
PolicyListQueryRequestBody policyListQueryRequestBody = new PolicyListQueryRequestBody(); PolicyListQueryRequestBody policyListQueryRequestBody = new PolicyListQueryRequestBody();
policyListQueryRequestBody.setStaffInfo(agent_id); policyListQueryRequestBody.setStaffInfo(agent_id);
policyListQueryRequestBody.setMyPolicyType("2"); policyListQueryRequestBody.setMyPolicyType("2");
policyListQueryRequestBody.setIsInsuredArray("0");
// 根据查询时间范围获取查询开始时间和结束时间 // 根据查询时间范围获取查询开始时间和结束时间
String startTime; String startTime = null;
String endTime; String endTime = null;
if (Integer.valueOf("1") == time) { if (Integer.valueOf("1") == time) {
startTime = CommonUtil.getBeginDayOfMonth(); startTime = CommonUtil.getBeginDayOfMonth();
endTime = CommonUtil.getEndDayOfMonth(); endTime = CommonUtil.getEndDayOfMonth();
} else if (Integer.valueOf("3") == time) { } else if (Integer.valueOf("3") == time) {
startTime = CommonUtil.getStartOrEndDayOfQuarter(true); startTime = CommonUtil.getStartOrEndDayOfQuarter(true);
endTime = CommonUtil.getStartOrEndDayOfQuarter(false); endTime = CommonUtil.getStartOrEndDayOfQuarter(false);
} else { } else if (Integer.valueOf("2") == time) {
startTime = CommonUtil.getBeginDayOfYear(); startTime = CommonUtil.getBeginDayOfYear();
endTime = CommonUtil.getEndDayOfYear(); endTime = CommonUtil.getEndDayOfYear();
} }
...@@ -252,7 +258,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -252,7 +258,7 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
responseVO.setStartDate(policyDetail.getEffectiveDate()); responseVO.setStartDate(policyDetail.getEffectiveDate());
responseVO.setEndDate(policyDetail.getExpiryDate()); responseVO.setEndDate(policyDetail.getExpiryDate());
responseVO.setPrice(policyDetail.getPremium()); responseVO.setPrice(policyDetail.getPremium());
responseVO.setStatus(policyDetail.getPolicyStatus()); responseVO.setStatus(N22Utils.getN22PolicyStatus(policyDetail.getPolicyStatus()));
// 投保人信息 // 投保人信息
HolderInfo holderInfo = new HolderInfo(); HolderInfo holderInfo = new HolderInfo();
...@@ -307,83 +313,53 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -307,83 +313,53 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
public PayScaleQueryResponseVO payScaleListQuery(PayScaleQueryRequestVO requestVO) { public PayScaleQueryResponseVO payScaleListQuery(PayScaleQueryRequestVO requestVO) {
PayScaleQueryResponseVO responseVO = new PayScaleQueryResponseVO(); PayScaleQueryResponseVO responseVO = new PayScaleQueryResponseVO();
String practitionerIdEG = requestVO.getPractitionerIdEG(); String practitionerIdEG = requestVO.getPractitionerIdEG();
Long practitionerId = requestVO.getPractitionerId();
Map<Long,PayScaleInfo> payScaleInfoMap = new HashMap<>();
if(!Strings.isNullOrEmpty(practitionerIdEG)){
List<PayScaleInfo> payScaleInfoListAll = aclPractitionerDALService.findPayScaleByPractitionerEG(practitionerIdEG);
if(!payScaleInfoListAll.isEmpty()){
Map<String,String> dtlTypeMap = new HashMap<>();
Map<String,String> titleMap = new HashMap<>();
List<OptionsEGolden> optionsEGoldenList = mdDropOptionsDALService.findByMasterIdsE(Collections.singletonList(101));
optionsEGoldenList.forEach(i->dtlTypeMap.put(i.getOptAttr(),i.getOptName()));
List<OptionsEGolden> titleList = mdDropOptionsDALService.findAllTitleEG();
titleList.forEach(i->titleMap.put(i.getTitleCode(),i.getTitleName()));
// 1.根据Agent_id当前经纪人的佣金明细 PayScaleInfo payScaleInfo;
SalaryDetailsSearchRequestBody salaryDetailsSearchRequestBody = new SalaryDetailsSearchRequestBody(); Long time;
salaryDetailsSearchRequestBody.setLoginName(practitionerIdEG); for(PayScaleInfo item : payScaleInfoListAll){
salaryDetailsSearchRequestBody.setSearchType("1"); time = item.getMonDtlPeriod();
SalaryDetailsSearchResponseVO salaryDetailsSearchResponseVO = n22SalaryService.salaryDetailsSearch(salaryDetailsSearchRequestBody); if(payScaleInfoMap.containsKey(time)){
payScaleInfo = payScaleInfoMap.get(time);
calculateRAmount(payScaleInfo,item);
}else{
calculateRAmount(item,item);
item.setMonDtlItem("实发薪水");
payScaleInfoMap.put(time,item);
item.setDrpTitleCode(titleMap.get(item.getDrpTitleCode()));
item.setMonDtlType(dtlTypeMap.get(item.getMonDtlType()));
if (!"查询成功".equals(salaryDetailsSearchResponseVO.getResponseHead().getMessage())){
responseVO.setCommonResult(new CommonResult(false, "查询N22佣金明细列表错误"));
return responseVO;
} }
List<SalaryDetails> salaryDetailsList = salaryDetailsSearchResponseVO.getResponseBody().getSalaryDetailsLIST(); }
//修改金钱格式
// list分组 for(PayScaleInfo item : payScaleInfoListAll){
Map<String, List<SalaryDetails>> group = n22SalaryService.groupByYearmonth(salaryDetailsList); item.setMonDtlRAmount(CommonUtil.doubleFormat(item.getMonDtlRAmount(),2));
}
// 组装返回参数
List<PayScaleInfo> resultList = new ArrayList<>();
for (String key : group.keySet()) {
System.out.println("Key = " + key);
List<SalaryDetails> list = group.get(key);
// 计算每组应发佣金总和
Double monDtlAmount = this.getSummary(list);
PayScaleInfo payScaleInfo = new PayScaleInfo();
payScaleInfo.setMonDtlAmount(monDtlAmount);
payScaleInfo.setMonDtlItem("实发薪水");
payScaleInfo.setDrpTitleCode(list.get(0).getGrade());
payScaleInfo.setMonDtlPeriod(Long.valueOf(key));
resultList.add(payScaleInfo);
} }
}
List<PayScaleInfo> resultList = new ArrayList<>(payScaleInfoMap.values());
// 加入临时薪资表的数据
List<AgAclLifePractitionerSalary> list = practitionerSalaryMapper.queryListByPractitionerId(practitionerId);
translateObj(list, resultList);
// 排序
resultList.sort(Comparator.comparingLong(PayScaleInfo :: getMonDtlPeriod).reversed()); resultList.sort(Comparator.comparingLong(PayScaleInfo :: getMonDtlPeriod).reversed());
responseVO.setPayScaleInfos(resultList); responseVO.setPayScaleInfos(resultList);
// if(!Strings.isNullOrEmpty(practitionerIdEG)){ responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
// List<PayScaleInfo> payScaleInfoListAll = aclPractitionerDALService.findPayScaleByPractitionerEG(practitionerIdEG);
// if(!payScaleInfoListAll.isEmpty()){
// Map<String,String> dtlTypeMap = new HashMap<>();
// Map<String,String> titleMap = new HashMap<>();
// List<OptionsEGolden> optionsEGoldenList = mdDropOptionsDALService.findByMasterIdsE(Collections.singletonList(101));
// optionsEGoldenList.forEach(i->dtlTypeMap.put(i.getOptAttr(),i.getOptName()));
// List<OptionsEGolden> titleList = mdDropOptionsDALService.findAllTitleEG();
// titleList.forEach(i->titleMap.put(i.getTitleCode(),i.getTitleName()));
// Map<Integer,PayScaleInfo> payScaleInfoMap = new HashMap<>();
// PayScaleInfo payScaleInfo;
// Integer time;
// for(PayScaleInfo item : payScaleInfoListAll){
// time = item.getMonDtlPeriod();
// if(payScaleInfoMap.containsKey(time)){
// payScaleInfo = payScaleInfoMap.get(time);
// calculateRAmount(payScaleInfo,item);
// }else{
// calculateRAmount(item,item);
// item.setMonDtlItem("实发薪水");
// payScaleInfoMap.put(time,item);
// item.setDrpTitleCode(titleMap.get(item.getDrpTitleCode()));
// item.setMonDtlType(dtlTypeMap.get(item.getMonDtlType()));
//
// }
// }
// //修改金钱格式
// for(PayScaleInfo item : payScaleInfoListAll){
// item.setMonDtlRAmount(CommonUtil.doubleFormat(item.getMonDtlRAmount(),2));
// }
// List<PayScaleInfo> resultList = new ArrayList<>(payScaleInfoMap.values());
// resultList.sort(Comparator.comparingInt(PayScaleInfo :: getMonDtlPeriod).reversed());
// responseVO.setPayScaleInfos(resultList);
// }
// responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
// }else{
// String[] params = {"practitionerIdEG"};
// responseVO.setCommonResult(new CommonResult(false, ZHBErrorConfig.getErrorInfo("610002", params)));
// }
return responseVO; return responseVO;
} }
...@@ -401,16 +377,6 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe ...@@ -401,16 +377,6 @@ public class PractitionerBasicInfoServiceImpl implements PractitionerBasicInfoSe
} }
} }
private Double getSummary(List<SalaryDetails> list) {
Double sum = 0D;
for (SalaryDetails item : list) {
sum = BigDecimal.valueOf(item.getCommission())
.add(BigDecimal.valueOf(sum))
.doubleValue();
}
return sum;
}
@Override @Override
public PayScalePdfResponseVO payScalePdf(PayScalePdfRequestVO requestVO) { public PayScalePdfResponseVO payScalePdf(PayScalePdfRequestVO requestVO) {
PayScalePdfResponseVO responseVO = new PayScalePdfResponseVO(); PayScalePdfResponseVO responseVO = new PayScalePdfResponseVO();
......
...@@ -203,6 +203,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -203,6 +203,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
isSpecial = mobileSpecials.contains(mobileNo); isSpecial = mobileSpecials.contains(mobileNo);
} }
// if(28L == practitionerType || isSpecial){//只有寿险的经纪人和注册为经纪人的员工才能登录 // if(28L == practitionerType || isSpecial){//只有寿险的经纪人和注册为经纪人的员工才能登录
PractitionerBasicInfo practitionerBasicInfo = aclPractitionerDALService.findByMobileNoE(mobileNo);
Long practitionerId = practitionerInfo.getPractitionerId(); Long practitionerId = practitionerInfo.getPractitionerId();
Long customerId = practitionerInfo.getCustomerId(); Long customerId = practitionerInfo.getCustomerId();
AclCustomer customer = aclCustomerDALService.findById(customerId); AclCustomer customer = aclCustomerDALService.findById(customerId);
...@@ -222,24 +223,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -222,24 +223,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
basicInfo.setSubordinateLeader(subordinateInfo.getSubordinateLeader()); basicInfo.setSubordinateLeader(subordinateInfo.getSubordinateLeader());
} }
} }
if(practitionerBasicInfo != null){
// 1.根据手机号查询经纪人在N22系统的Agent_id responseVO.setPractitionerIdEG(practitionerBasicInfo.getPractitionerId());
GetStaffNewRequestBody getStaffNewRequestBody = new GetStaffNewRequestBody();
getStaffNewRequestBody.setMobile(mobileNo);
GetStaffNewResponseVO resp = n22StaffService.getStaffNew(getStaffNewRequestBody);
if(resp != null){
if ("查询成功".equals(resp.getResponseHead().getMessage())){
List<Staff> staffList = resp.getResponseBody().getStaff();
if (staffList.size() > 0) {
Staff staff = staffList.get(0);
String agent_id = staff.getAgent_id();
responseVO.setPractitionerIdEG(agent_id);
}
}
} }
//获取用户的登录次数 //获取用户的登录次数
List<AclCustomerLog> customerLogList = aclCustomerLogDALService.findLogInfoByCustomerId(customerId); List<AclCustomerLog> customerLogList = aclCustomerLogDALService.findLogInfoByCustomerId(customerId);
int logTimes = (customerLogList.isEmpty()) ? 0 : customerLogList.size(); int logTimes = (customerLogList.isEmpty()) ? 0 : customerLogList.size();
......
...@@ -3,6 +3,7 @@ package com.yd.api.practitioner.vo.policy; ...@@ -3,6 +3,7 @@ package com.yd.api.practitioner.vo.policy;
public class PolicyListQueryRequestVO { public class PolicyListQueryRequestVO {
private Long practitionerId; private Long practitionerId;
private Integer time; private Integer time;
private Integer platform;//平台,1--yd,2--N22
public Long getPractitionerId() { public Long getPractitionerId() {
return practitionerId; return practitionerId;
...@@ -19,4 +20,12 @@ public class PolicyListQueryRequestVO { ...@@ -19,4 +20,12 @@ public class PolicyListQueryRequestVO {
public void setTime(Integer time) { public void setTime(Integer time) {
this.time = time; this.time = time;
} }
public Integer getPlatform() {
return platform;
}
public void setPlatform(Integer platform) {
this.platform = platform;
}
} }
...@@ -37,6 +37,7 @@ public class N22Utils { ...@@ -37,6 +37,7 @@ public class N22Utils {
postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"GBK"); postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"GBK");
postMethod.setRequestHeader("Content_Type","application/json;charset=utf-8"); postMethod.setRequestHeader("Content_Type","application/json;charset=utf-8");
postMethod.setRequestHeader("Accept","application/json;charset=utf-8"); postMethod.setRequestHeader("Accept","application/json;charset=utf-8");
postMethod.setRequestHeader("eliteSign","n9WLrWtWrNmUlhw8SvvwIhyDJXsS1OPWRzUFBPbj89TWRJTfuk4SITBhAiSmNMY6");
RequestEntity requestEntity = new StringRequestEntity(requestJson,"application/json","UTF-8"); RequestEntity requestEntity = new StringRequestEntity(requestJson,"application/json","UTF-8");
postMethod.setRequestEntity(requestEntity); postMethod.setRequestEntity(requestEntity);
int statusCode = httpClient.executeMethod(postMethod); int statusCode = httpClient.executeMethod(postMethod);
...@@ -74,4 +75,20 @@ public class N22Utils { ...@@ -74,4 +75,20 @@ public class N22Utils {
public static Long getN22RelationType(String idType) { public static Long getN22RelationType(String idType) {
return null; return null;
} }
public static String getN22PolicyStatus(String policyStatus) {
//(1, "投保")
//(2, "已承保/已回执")
//(3, "未支付/支付失败")
//(7, "支付成功")
//(98, "撤单")
switch(policyStatus){
case "1": return "投保";
case "2": return "已承保/已回执";
case "3": return "未支付/支付失败";
case "7": return "支付成功";
case "98": return "撤单";
}
return "";
}
} }
...@@ -29,10 +29,12 @@ public class N22PolicyServiceImpl implements N22PolicyService { ...@@ -29,10 +29,12 @@ public class N22PolicyServiceImpl implements N22PolicyService {
obj.put("requestBody", requestBody); obj.put("requestBody", requestBody);
logger.info("N22查询保单列表请求报文:"+obj.toString()); logger.info("N22查询保单列表请求报文:"+obj.toString());
String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/PolicyList"; // String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/PolicyList";
String url = "http://101.132.32.185:8082/EliteGeneralHttpTask/GeneralService/PolicyList";
String result = N22Utils.postTransaction(url, obj.toString()); String result = N22Utils.postTransaction(url, obj.toString());
logger.info("N22查询保单列表响应报文:"+result); // logger.info("N22查询保单列表响应报文:"+result);
rObj = JSONObject.parseObject(result, PolicyListQueryResponseVO.class); rObj = JSONObject.parseObject(result, PolicyListQueryResponseVO.class);
return rObj; return rObj;
...@@ -45,12 +47,14 @@ public class N22PolicyServiceImpl implements N22PolicyService { ...@@ -45,12 +47,14 @@ public class N22PolicyServiceImpl implements N22PolicyService {
JSONObject requestHead = new JSONObject(); JSONObject requestHead = new JSONObject();
requestHead.put("seqNo", UUID.randomUUID().toString()); requestHead.put("seqNo", UUID.randomUUID().toString());
requestHead.put("appId", "eliteNgpcrtaVU9NAz");
obj.put("requestHead", requestHead); obj.put("requestHead", requestHead);
obj.put("requestBody", requestBody); obj.put("requestBody", requestBody);
logger.info("N22查询保单详情请求报文:"+obj.toString()); logger.info("N22查询保单详情请求报文:"+obj.toString());
String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/PolicyInfo"; // String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/PolicyInfo";
String url = "http://101.132.32.185:8082/EliteGeneralHttpTask/GeneralService/PolicyInfo";
String result = N22Utils.postTransaction(url, obj.toString()); String result = N22Utils.postTransaction(url, obj.toString());
logger.info("N22查询保单详情响应报文:"+result); logger.info("N22查询保单详情响应报文:"+result);
......
...@@ -28,12 +28,13 @@ public class N22StaffServiceImpl implements N22StaffService { ...@@ -28,12 +28,13 @@ public class N22StaffServiceImpl implements N22StaffService {
obj.put("requestHead", requestHead); obj.put("requestHead", requestHead);
obj.put("requestBody", getStaffNewRequestBody); obj.put("requestBody", getStaffNewRequestBody);
logger.info("N22查询保单列表请求报文:"+obj.toString()); logger.info("N22员工查询请求报文:"+obj.toString());
String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/getStaffNew"; // String url = "https://life.ydinsurance.cn/EliteGeneralHttpTask/GeneralService/getStaffNew";
String url = "http://101.132.32.185:8082/EliteGeneralHttpTask/GeneralService/getStaffNew";
String result = N22Utils.postTransaction(url, obj.toString()); String result = N22Utils.postTransaction(url, obj.toString());
logger.info("N22查询保单列表响应报文:"+result); logger.info("N22员工查询响应报文:"+result);
GetStaffNewResponseVO response = JSONObject.parseObject(result, GetStaffNewResponseVO.class); GetStaffNewResponseVO response = JSONObject.parseObject(result, GetStaffNewResponseVO.class);
......
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