|
@@ -11,6 +11,7 @@ import com.dgtis.common.core.web.domain.AjaxResult;
|
|
|
import com.dgtis.common.security.utils.SecurityUtils;
|
|
|
import com.dgtis.data.domain.Customer;
|
|
|
import com.dgtis.data.service.ISysUserService;
|
|
|
+import com.dgtis.data.util.AddressResolutionUtil;
|
|
|
import com.dgtis.system.api.domain.SysUser;
|
|
|
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
|
|
import org.apache.http.HttpEntity;
|
|
@@ -83,7 +84,7 @@ public class CustomerApiController {
|
|
|
//1.如果存在保单信息的查询条件,需要先查询保单信息然后通过保单关联出客户信息
|
|
|
//处理保单查询条件
|
|
|
List<String> customerIds = new ArrayList<String>();
|
|
|
- if(StringUtils.isNotEmpty(policybelong) || StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
|
|
|
+ if(StringUtils.isNotEmpty(payS) || StringUtils.isNotEmpty(payE)
|
|
|
|| StringUtils.isNotEmpty(insuredAmountS) || StringUtils.isNotEmpty(insuredAmountE)
|
|
|
|| StringUtils.isNotEmpty(productname) || StringUtils.isNotEmpty(fadate)){
|
|
|
customerIds = queryInsurancearrangement(policybelong,payS,payE,fadate,productname,insuredAmountS,insuredAmountE);
|
|
@@ -129,7 +130,7 @@ public class CustomerApiController {
|
|
|
builder.append("{\"term\":{\"custclass\":\""+custclass+"\"}},");
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(sobirth)){
|
|
|
- builder.append("{\"wildcard\":{\"sobirth\":\"*"+sobirth+"*\"}},");//模糊匹配
|
|
|
+ builder.append("{\"wildcard\":{\"ral\":\"*"+sobirth+"*\"}},");//模糊匹配
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(SCustID)){
|
|
@@ -156,10 +157,10 @@ public class CustomerApiController {
|
|
|
builder.append("{\"range\":{\"fadate\":{\"gte\":\""+participantsDateS+"\",\"lte\":\""+participantsDateE+"\"}}},");
|
|
|
}else{
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(beginBirthDay)){
|
|
|
+ if(StringUtils.isNotEmpty(participantsDateS)){
|
|
|
builder.append("{\"range\":{\"fadate\":{\"gte\":\""+participantsDateS+"\"}}},");
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(endBirthDay)){
|
|
|
+ if(StringUtils.isNotEmpty(participantsDateE)){
|
|
|
builder.append("{\"range\":{\"fadate\":{\"lte\":\""+participantsDateE+"\"}}},");
|
|
|
}
|
|
|
}
|
|
@@ -525,8 +526,7 @@ public class CustomerApiController {
|
|
|
// 获取索引的别名,字段,创建时间http://10.32.2.231:9200/shanglifeecif.individual/default_type_/1
|
|
|
try {
|
|
|
logger.info("进客户概览时间:"+DateUtils.getTime());
|
|
|
- Map<String, String> paramMap = new HashMap<String, String>();
|
|
|
- paramMap.put("pretty", "true");
|
|
|
+
|
|
|
Request scriptRequest = new Request("GET", "shanglifeecif.individual/default_type_/"+id+"?pretty=true");
|
|
|
Response response = restClient.performRequest(scriptRequest);
|
|
|
|
|
@@ -648,7 +648,7 @@ public class CustomerApiController {
|
|
|
}
|
|
|
majorCategorie.put(risk_categories_name,risk);
|
|
|
}else{
|
|
|
- if(_source.containsKey("risk")){
|
|
|
+ if(_source.containsKey("risk") && StringUtils.isNotEmpty(risk_categories_name)){
|
|
|
majorCategorie.put(risk_categories_name,_source.getDouble("risk"));
|
|
|
}
|
|
|
}
|
|
@@ -690,8 +690,8 @@ public class CustomerApiController {
|
|
|
map.put("insuranceclaimthread",insuranceclaimthread);
|
|
|
mpInfo.put("prem",df.format(prem));
|
|
|
mpInfo.put("sumprem",df.format(sumprem));
|
|
|
- mpInfo.put("insureDay",insureDay);
|
|
|
- mpInfo.put("guaranteeDay",guaranteeDay>insureDay?insureDay:guaranteeDay);
|
|
|
+ mpInfo.put("insureDay",(insureDay/365) +"年"+(insureDay%365)+"天");
|
|
|
+ mpInfo.put("guaranteeDay",guaranteeDay>insureDay?(insureDay/365) +"年"+(insureDay%365)+"天":(guaranteeDay/365) +"年"+(guaranteeDay%365)+"天");
|
|
|
map.put("custInfo",mpInfo);
|
|
|
map.put("majorCategorie",majorCategorie);
|
|
|
logger.info("出客户概览时间:"+DateUtils.getTime());
|
|
@@ -704,19 +704,192 @@ public class CustomerApiController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export")
|
|
|
- public void export(HttpServletResponse response, HttpServletRequest request)
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, HttpServletRequest request,String education,//学历
|
|
|
+ String policybelong,//业绩归属
|
|
|
+ String payS,String payE, //年缴费区间
|
|
|
+ String fadate,//投保年份
|
|
|
+ String productname,//险种类别
|
|
|
+ String insuredAmountS,String insuredAmountE,//保额区间
|
|
|
+ String ageS,String ageE,//年龄区间
|
|
|
+ String gender,//性别
|
|
|
+ String sobirth,//省份
|
|
|
+ String NOVPolicy,//保单件数
|
|
|
+ String custtype,//客户类型 投保人
|
|
|
+ String SCustID,// 核心客户号
|
|
|
+ String custclass,//客户等级
|
|
|
+ String participantsDateS,String participantsDateE,//参与方时间
|
|
|
+ String PIncomeS,String PIncomeE,//年收入区间
|
|
|
+ String Insured,//投保对象
|
|
|
+ String lp,//理赔
|
|
|
+ String yx,//有效
|
|
|
+ String gzgw,//关注官微
|
|
|
+ String zcgw//注册官微
|
|
|
+ ) {
|
|
|
logger.info("导出进时间:"+DateUtils.getTime());
|
|
|
+ String beginBirthDay = "";
|
|
|
+ String endBirthDay = "";
|
|
|
+ if(StringUtils.isNotEmpty(ageS)){
|
|
|
+ String year = DateUtils.getYYYY();
|
|
|
+ int bYear = Integer.parseInt(year)-Integer.parseInt(ageS);
|
|
|
+ endBirthDay = bYear+"-"+DateUtils.getMMDD();
|
|
|
+ }
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(ageE)){
|
|
|
+ String year = DateUtils.getYYYY();
|
|
|
+ int bYear = Integer.parseInt(year)-Integer.parseInt(ageE);
|
|
|
+ beginBirthDay = bYear+"-"+DateUtils.getMMDD();
|
|
|
+ }
|
|
|
try{
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
SysUser sysUser = userService.selectUserById(userId);
|
|
|
String deptCode = sysUser.getDept().getDeptCode();
|
|
|
- String url = "/shanglifeecif.individual/_search?sort=scustid:asc&&size=10000&scroll=5m";
|
|
|
+ //拼装查询条件
|
|
|
+ StringBuilder builder =new StringBuilder();
|
|
|
+ builder.append("{");
|
|
|
+ builder.append("\"query\":{");//query开始
|
|
|
+ builder.append("\"bool\":{");//boot开始
|
|
|
+ builder.append("\"must\":[");//must开始
|
|
|
+ //业绩归属字段
|
|
|
if(StringUtils.isNotEmpty(deptCode)){
|
|
|
- url = "/shanglifeecif.individual/_search?q=policybelong:"+deptCode+"&sort=scustid:asc&&size=10000&scroll=5m";
|
|
|
+ builder.append("{\"prefix\":{\"policybelong\":\""+deptCode+"\"}},");
|
|
|
}
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(gender)){
|
|
|
+ builder.append("{\"prefix\":{\"gender\":"+gender+"}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(NOVPolicy)){
|
|
|
+ builder.append("{\"prefix\":{\"label25\":\""+NOVPolicy+"\"}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(custclass)){
|
|
|
+ builder.append("{\"term\":{\"custclass\":\""+custclass+"\"}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(sobirth)){
|
|
|
+ builder.append("{\"wildcard\":{\"ral\":\"*"+sobirth+"*\"}},");//模糊匹配
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(SCustID)){
|
|
|
+ builder.append("{\"wildcard\":{\"scustid\":\"*"+SCustID+"*\"}},");//模糊匹配
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(custtype)){
|
|
|
+ builder.append("{\"wildcard\":{\"custtype\":\"*"+custtype+"*\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(beginBirthDay) && StringUtils.isNotEmpty(endBirthDay)){
|
|
|
+ builder.append("{\"range\":{\"birthday\":{\"gte\":\""+beginBirthDay+"\",\"lte\":\""+endBirthDay+"\"}}},");
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(beginBirthDay)){
|
|
|
+ builder.append("{\"range\":{\"birthday\":{\"gte\":\""+beginBirthDay+"\"}}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(endBirthDay)){
|
|
|
+ builder.append("{\"range\":{\"birthday\":{\"lte\":\""+endBirthDay+"\"}}},");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(participantsDateS) && StringUtils.isNotEmpty(participantsDateE)){
|
|
|
+ builder.append("{\"range\":{\"fadate\":{\"gte\":\""+participantsDateS+"\",\"lte\":\""+participantsDateE+"\"}}},");
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(participantsDateS)){
|
|
|
+ builder.append("{\"range\":{\"fadate\":{\"gte\":\""+participantsDateS+"\"}}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(participantsDateE)){
|
|
|
+ builder.append("{\"range\":{\"fadate\":{\"lte\":\""+participantsDateE+"\"}}},");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(PIncomeS) && StringUtils.isNotEmpty(PIncomeE)){
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"gte\":\""+PIncomeS+"\",\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(PIncomeS)){
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"gte\":\""+PIncomeS+"\"}}},");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(PIncomeE)){
|
|
|
+ builder.append("{\"range\":{\"pincome\":{\"lte\":\""+PIncomeE+"\"}}},");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(yx)){
|
|
|
+ if (yx.equals("0")){
|
|
|
+ builder.append("{\"range\":{\"novpolicy\":{\"gt\":\""+yx+"\"}}},");
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ builder.append("{\"prefix\":{\"label91\":\"失效客户\"}},");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(education)){
|
|
|
+ String[] edus = education.split("&");
|
|
|
+ builder.append("{\"terms\":{\"education\":[");
|
|
|
+ for (String edu:edus) {
|
|
|
+ builder.append("\""+edu+"\",");
|
|
|
+ }
|
|
|
+ builder.delete(builder.length()-1,builder.length());
|
|
|
+ builder.append ("]}},");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(gzgw) && "0".equals(gzgw)){
|
|
|
+ builder.append("{\"prefix\":{\"label73\":\"关注官微\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(zcgw) && "0".equals(zcgw)){
|
|
|
+ builder.append("{\"prefix\":{\"label74\":\"注册官微\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(lp) && "0".equals(lp)){
|
|
|
+ builder.append("{\"prefix\":{\"label57\":\"最近一次理赔类型\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(gender) || StringUtils.isNotEmpty(NOVPolicy) || StringUtils.isNotEmpty(custtype)
|
|
|
+ || StringUtils.isNotEmpty(custclass) || StringUtils.isNotEmpty(sobirth) || StringUtils.isNotEmpty(SCustID)
|
|
|
+ || StringUtils.isNotEmpty(beginBirthDay) || StringUtils.isNotEmpty(endBirthDay) || StringUtils.isNotEmpty(education)
|
|
|
+ || StringUtils.isNotEmpty(PIncomeS) || StringUtils.isNotEmpty(PIncomeE) || (StringUtils.isNotEmpty(gzgw) && "0".equals(gzgw))
|
|
|
+ || (StringUtils.isNotEmpty(zcgw) && "0".equals(zcgw)) || StringUtils.isNotEmpty(yx)
|
|
|
+ || (StringUtils.isNotEmpty(lp) && "0".equals(lp) || StringUtils.isNotEmpty(deptCode) ||
|
|
|
+ StringUtils.isNotEmpty(participantsDateS) || StringUtils.isNotEmpty(participantsDateE))){
|
|
|
+ builder.delete(builder.length()-1,builder.length());
|
|
|
+ }
|
|
|
+
|
|
|
+ builder.append("],");//must结束
|
|
|
+ builder.append("\"must_not\":[");//must_not
|
|
|
+ if(StringUtils.isNotEmpty(gzgw) && "1".equals(gzgw)){
|
|
|
+ builder.append("{\"prefix\":{\"label73\":\"关注官微\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(zcgw) && "1".equals(zcgw)){
|
|
|
+ builder.append("{\"prefix\":{\"label74\":\"注册官微\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(lp) && "1".equals(lp)){
|
|
|
+ builder.append("{\"prefix\":{\"label57\":\"最近一次理赔类型\"}},");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(
|
|
|
+ (StringUtils.isNotEmpty(gzgw) && "1".equals(gzgw))
|
|
|
+ || (StringUtils.isNotEmpty(zcgw) && "1".equals(zcgw))
|
|
|
+ || (StringUtils.isNotEmpty(lp) && "1".equals(lp))
|
|
|
+ ){
|
|
|
+ builder.delete(builder.length()-1,builder.length());
|
|
|
+ }
|
|
|
+
|
|
|
+ builder.append("],");
|
|
|
+ builder.append("\"should\":[]");//should
|
|
|
+ builder.append("}");//boot结束
|
|
|
+ builder.append("},");//query结束
|
|
|
+ builder.append("\"from\":"+0+",");//第几页
|
|
|
+ builder.append("\"size\":"+10000+",");//查询几个
|
|
|
+ builder.append("\"sort\":[{\"scustid\":{\"order\":\"asc\"}}],");//排序
|
|
|
+ builder.append("\"aggs\":{}");//
|
|
|
+ builder.append("}");
|
|
|
+
|
|
|
+
|
|
|
+ HttpEntity entity = new NStringEntity(builder.toString(), ContentType.APPLICATION_JSON);
|
|
|
+ String url = "/shanglifeecif.individual/_search?&scroll=5m";
|
|
|
Request scriptRequest = new Request("GET", url);
|
|
|
+ scriptRequest.setEntity(entity);
|
|
|
Response responseData = restClient.performRequest(scriptRequest);
|
|
|
String result = EntityUtils.toString(responseData.getEntity());
|
|
|
JSONObject jsonObject = JSON.parseObject(result);
|
|
@@ -724,7 +897,7 @@ public class CustomerApiController {
|
|
|
JSONArray array = JSON.parseArray(hitsobject.get("hits").toString());
|
|
|
List<Customer> customers = new ArrayList<Customer>();
|
|
|
String scroll_id = jsonObject.getString("_scroll_id");
|
|
|
- HttpEntity entity = new NStringEntity("{\n" +
|
|
|
+ entity = new NStringEntity("{\n" +
|
|
|
" \"scroll_id\": \""+scroll_id+"\",\n" +
|
|
|
" \"scroll\": \"5m\"\n" +
|
|
|
"}", ContentType.APPLICATION_JSON);
|
|
@@ -749,6 +922,8 @@ public class CustomerApiController {
|
|
|
customer.setVaild(StringUtils.isEmpty(jsonOb.getString("label91"))?"有效":"无效");
|
|
|
customer.setpIncome(jsonOb.getString("pincome"));
|
|
|
customer.setNum(jsonOb.getString("label25"));
|
|
|
+ String ral = jsonOb.getString("ral");
|
|
|
+ customer.setProvince(StringUtils.isNotBlank(ral)?ral.substring(0,3):"");
|
|
|
if(mp.containsKey("birthday")){
|
|
|
String birthday = jsonOb.getString("birthday").length()>10?jsonOb.getString("birthday").substring(0,10):jsonOb.getString("birthday");
|
|
|
mp.put("birthday", birthday);
|
|
@@ -772,8 +947,8 @@ public class CustomerApiController {
|
|
|
}
|
|
|
|
|
|
if(mp.containsKey("custclass")){
|
|
|
- String custclass = jsonOb.getString("custclass");
|
|
|
- switch (custclass){
|
|
|
+ String custclazz = jsonOb.getString("custclass");
|
|
|
+ switch (custclazz){
|
|
|
case "1":
|
|
|
customer.setCustClass("钻石");
|
|
|
case "2":
|
|
@@ -790,7 +965,7 @@ public class CustomerApiController {
|
|
|
customer.setCustClass("无");
|
|
|
}
|
|
|
|
|
|
- if(mp.containsKey("policybelong")){
|
|
|
+ /*if(mp.containsKey("policybelong")){
|
|
|
String policybelong = jsonOb.getString("policybelong");
|
|
|
switch (policybelong){
|
|
|
case "00":
|
|
@@ -807,7 +982,7 @@ public class CustomerApiController {
|
|
|
customer.setPolicyBelong("健康险事业部");
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
customers.add(customer);
|
|
|
}
|